Index: trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java	(revision 8291)
+++ trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java	(revision 8304)
@@ -4,6 +4,4 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
 import java.text.DateFormat;
 import java.text.MessageFormat;
@@ -18,5 +16,4 @@
 import java.util.Map.Entry;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -258,9 +255,5 @@
             sb.append("user").append("=").append(uid);
         } else if (userName != null) {
-            try {
-                sb.append("display_name").append("=").append(URLEncoder.encode(userName, "UTF-8"));
-            } catch (UnsupportedEncodingException e) {
-                Main.error(e);
-            }
+            sb.append("display_name").append("=").append(Utils.encodeUrl(userName));
         }
         if (bounds != null) {
Index: trunk/src/org/openstreetmap/josm/io/OsmApi.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 8291)
+++ trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 8304)
@@ -15,5 +15,4 @@
 import java.io.StringReader;
 import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
 import java.net.ConnectException;
 import java.net.HttpURLConnection;
@@ -21,5 +20,4 @@
 import java.net.SocketTimeoutException;
 import java.net.URL;
-import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.util.Collection;
@@ -815,5 +813,5 @@
             .append(latlon.lon())
             .append("&text=")
-            .append(urlEncode(text)).toString();
+            .append(Utils.encodeUrl(text)).toString();
 
         String response = sendRequest("POST", noteUrl, null, monitor, true, false);
@@ -833,5 +831,5 @@
         String noteUrl = noteStringBuilder(note)
             .append("/comment?text=")
-            .append(urlEncode(comment)).toString();
+            .append(Utils.encodeUrl(comment)).toString();
 
         String response = sendRequest("POST", noteUrl, null, monitor, true, false);
@@ -849,5 +847,5 @@
     public Note closeNote(Note note, String closeMessage, ProgressMonitor monitor) throws OsmTransferException {
         initialize(monitor);
-        String encodedMessage = urlEncode(closeMessage);
+        String encodedMessage = Utils.encodeUrl(closeMessage);
         StringBuilder urlBuilder = noteStringBuilder(note)
             .append("/close");
@@ -871,5 +869,5 @@
     public Note reopenNote(Note note, String reactivateMessage, ProgressMonitor monitor) throws OsmTransferException {
         initialize(monitor);
-        String encodedMessage = urlEncode(reactivateMessage);
+        String encodedMessage = Utils.encodeUrl(reactivateMessage);
         StringBuilder urlBuilder = noteStringBuilder(note)
             .append("/reopen");
@@ -897,13 +895,3 @@
         }
     }
-
-    /** URL encodes a string. Useful for transforming user input into URL query strings*/
-    private String urlEncode(String string) throws OsmTransferException {
-        try {
-            return URLEncoder.encode(string, "UTF-8");
-        } catch (UnsupportedEncodingException e) {
-            Main.error(e, true);
-            throw new OsmTransferException(tr("Error encoding string: {0}", string), e);
-        }
-    }
 }
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 8291)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 8304)
@@ -11,6 +11,4 @@
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Collection;
 import java.util.HashMap;
@@ -36,4 +34,5 @@
 import org.openstreetmap.josm.gui.util.TableHelper;
 import org.openstreetmap.josm.tools.GBC;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -263,9 +262,5 @@
                 public void run() {
                     String[] tags = null;
-                    try {
-                        tags = URLDecoder.decode(args.get("addtags"), "UTF-8").split("\\|");
-                    } catch (UnsupportedEncodingException e) {
-                        throw new RuntimeException(e);
-                    }
+                    tags = Utils.decodeUrl(args.get("addtags")).split("\\|");
                     Set<String> tagSet = new HashSet<>();
                     for (String tag : tags) {
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadDataHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadDataHandler.java	(revision 8291)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadDataHandler.java	(revision 8304)
@@ -5,6 +5,4 @@
 
 import java.io.ByteArrayInputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 
@@ -62,11 +60,7 @@
     @Override
     public String[] getUsageExamples() {
-        try {
-            final String data = URLEncoder.encode("<osm version='0.6'><node id='-1' lat='1' lon='2' /></osm>", "UTF-8");
-            return new String[]{
-                    "/load_data?layer_name=extra_layer&new_layer=true&data=" + data};
-        } catch (UnsupportedEncodingException ex) {
-            throw new IllegalStateException(ex);
-        }
+        final String data = Utils.encodeUrl("<osm version='0.6'><node id='-1' lat='1' lon='2' /></osm>");
+        return new String[]{
+                "/load_data?layer_name=extra_layer&new_layer=true&data=" + data};
     }
 
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java	(revision 8291)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java	(revision 8304)
@@ -2,14 +2,8 @@
 package org.openstreetmap.josm.io.remotecontrol.handler;
 
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault;
-import org.openstreetmap.josm.tools.Utils;
-
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import java.io.UnsupportedEncodingException;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.URLDecoder;
 import java.text.MessageFormat;
 import java.util.Collections;
@@ -20,5 +14,10 @@
 import java.util.Map;
 
-import static org.openstreetmap.josm.tools.I18n.tr;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -210,10 +209,6 @@
         }
         for (String kv : uri.getRawQuery().split("&")) {
-            try {
-                final String[] kvs = URLDecoder.decode(kv, "UTF-8").split("=", 2);
-                r.put(kvs[0], kvs.length > 1 ? kvs[1] : null);
-            } catch (UnsupportedEncodingException ex) {
-                throw new IllegalStateException(ex);
-            }
+            final String[] kvs = Utils.decodeUrl(kv).split("=", 2);
+            r.put(kvs[0], kvs.length > 1 ? kvs[1] : null);
         }
         return r;
@@ -275,12 +270,4 @@
     }
 
-    protected static String decodeParam(String param) {
-        try {
-            return URLDecoder.decode(param, "UTF-8");
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
     public void setSender(String sender) {
         this.sender = sender;
@@ -333,9 +320,9 @@
                 String query = request.substring(request.indexOf('?') + 1);
                 if (query.indexOf("url=") == 0) {
-                    args.put("url", decodeParam(query.substring(4)));
+                    args.put("url", Utils.decodeUrl(query.substring(4)));
                 } else {
                     int urlIdx = query.indexOf("&url=");
                     if (urlIdx != -1) {
-                        args.put("url", decodeParam(query.substring(urlIdx + 5)));
+                        args.put("url", Utils.decodeUrl(query.substring(urlIdx + 5)));
                         query = query.substring(0, urlIdx);
                     } else if (query.indexOf('#') != -1) {
@@ -346,5 +333,5 @@
                         int eq = param.indexOf('=');
                         if (eq != -1) {
-                            args.put(param.substring(0, eq), decodeParam(param.substring(eq + 1)));
+                            args.put(param.substring(0, eq), Utils.decodeUrl(param.substring(eq + 1)));
                         }
                     }
