Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java	(revision 6971)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java	(revision 6972)
@@ -13,4 +13,5 @@
 import org.openstreetmap.josm.actions.downloadtasks.DownloadTask;
 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -113,5 +114,8 @@
     @Override
     protected void validateRequest() throws RequestHandlerBadRequestException {
-        final String urlString = args.get("url");
+        String urlString = args.get("url");
+        if (Main.pref.getBoolean("remotecontrol.importhandler.fix_url_query", true)) {
+            urlString = Utils.fixURLQuery(urlString);
+        }
         try {
             // Ensure the URL is valid
Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 6971)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 6972)
@@ -23,8 +23,10 @@
 import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
+import java.net.URLEncoder;
 import java.nio.channels.FileChannel;
 import java.nio.charset.Charset;
@@ -73,4 +75,6 @@
     private static final int MILLIS_OF_DAY = 86400000;
 
+    public static String URL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=";
+    
     /**
      * Tests whether {@code predicate} applies to at least one elements from {@code collection}.
@@ -982,3 +986,36 @@
         }
     }
+    
+    /**
+     * Fixes URL with illegal characters in the query (and fragment) part by 
+     * percent encoding those characters.
+     * 
+     * special characters like &amp; and # are not encoded
+     * 
+     * @param url the URL that should be fixed
+     * @return the repaired URL
+     */
+    public static String fixURLQuery(String url) {
+        if (url.indexOf('?') == -1) 
+            return url;
+        
+        String query = url.substring(url.indexOf('?') + 1);
+        
+        StringBuilder sb = new StringBuilder(url.substring(0, url.indexOf('?') + 1));
+        
+        for (int i=0; i<query.length(); i++) {
+            String c = query.substring(i, i+1);
+            if (URL_CHARS.contains(c)) {
+                sb.append(c);
+            } else {
+                try {
+                    sb.append(URLEncoder.encode(c, "UTF-8"));
+                } catch (UnsupportedEncodingException ex) {
+                    throw new RuntimeException(ex);
+                }
+            }
+        }
+        return sb.toString();
+    }
+    
 }
