Index: trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java	(revision 8303)
+++ trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java	(revision 8304)
@@ -7,6 +7,4 @@
 import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
 import java.util.Collections;
 import java.util.LinkedList;
@@ -23,4 +21,5 @@
 import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
 import org.openstreetmap.josm.io.OsmApi;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -98,10 +97,5 @@
         sb.append(closedLimit);
         sb.append("&q=");
-        try {
-            sb.append(URLEncoder.encode(searchTerm, "UTF-8"));
-        } catch (UnsupportedEncodingException ex) {
-            Main.error(ex, true); // thrown if UTF-8 isn't supported which seems unlikely.
-            return;
-        }
+        sb.append(Utils.encodeUrl(searchTerm));
 
         new DownloadNotesTask().loadUrl(false, sb.toString(), null);
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java	(revision 8303)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java	(revision 8304)
@@ -9,6 +9,4 @@
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
 import java.text.NumberFormat;
 import java.util.ArrayList;
@@ -25,5 +23,4 @@
 
 import javax.swing.AbstractAction;
-import javax.swing.JOptionPane;
 import javax.swing.JTable;
 import javax.swing.ListSelectionModel;
@@ -46,4 +43,5 @@
 import org.openstreetmap.josm.tools.OpenBrowser;
 import org.openstreetmap.josm.tools.Shortcut;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -62,8 +60,10 @@
     private ShowUserInfoAction showUserInfoAction;
 
+    /**
+     * Constructs a new {@code UserListDialog}.
+     */
     public UserListDialog() {
         super(tr("Authors"), "userlist", tr("Open a list of people working on the selected objects."),
                 Shortcut.registerShortcut("subwindow:authors", tr("Toggle: {0}", tr("Authors")), KeyEvent.VK_A, Shortcut.ALT_SHIFT), 150);
-
         build();
     }
@@ -221,17 +221,5 @@
         protected String createInfoUrl(Object infoObject) {
             User user = (User)infoObject;
-            try {
-                return Main.getBaseUserUrl() + "/" + URLEncoder.encode(user.getName(), "UTF-8").replaceAll("\\+", "%20");
-            } catch(UnsupportedEncodingException e) {
-                Main.error(e);
-                JOptionPane.showMessageDialog(
-                        Main.parent,
-                        tr("<html>Failed to create an URL because the encoding ''{0}''<br>"
-                                + "was missing on this system.</html>", "UTF-8"),
-                                tr("Missing encoding"),
-                                JOptionPane.ERROR_MESSAGE
-                );
-                return null;
-            }
+            return Main.getBaseUserUrl() + "/" + Utils.encodeUrl(user.getName()).replaceAll("\\+", "%20");
         }
 
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java	(revision 8303)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java	(revision 8304)
@@ -14,9 +14,7 @@
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
-import java.io.UnsupportedEncodingException;
 import java.net.HttpURLConnection;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -1073,8 +1071,8 @@
                 if (tagTable.getSelectedRowCount() == 1) {
                     row = tagTable.getSelectedRow();
-                    String key = URLEncoder.encode(tagData.getValueAt(row, 0).toString(), "UTF-8");
+                    String key = Utils.encodeUrl(tagData.getValueAt(row, 0).toString());
                     @SuppressWarnings("unchecked")
                     Map<String, Integer> m = (Map<String, Integer>) tagData.getValueAt(row, 1);
-                    String val = URLEncoder.encode(m.entrySet().iterator().next().getKey(), "UTF-8");
+                    String val = Utils.encodeUrl(m.entrySet().iterator().next().getKey());
 
                     uris.add(new URI(String.format("%s%sTag:%s=%s", base, lang, key, val)));
@@ -1088,5 +1086,5 @@
                     String type = ((Relation)membershipData.getValueAt(row, 0)).get("type");
                     if (type != null) {
-                        type = URLEncoder.encode(type, "UTF-8");
+                        type = Utils.encodeUrl(type);
                     }
 
@@ -1149,5 +1147,5 @@
                     }
                 });
-            } catch (URISyntaxException | UnsupportedEncodingException e1) {
+            } catch (URISyntaxException e1) {
                 Main.error(e1);
             }
Index: trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java	(revision 8303)
+++ trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java	(revision 8304)
@@ -364,5 +364,5 @@
         @Override
         protected void realRun() throws SAXException, IOException, OsmTransferException {
-            String urlString = useserver.url+java.net.URLEncoder.encode(searchExpression, "UTF-8");
+            String urlString = useserver.url+Utils.encodeUrl(searchExpression);
 
             try {
Index: trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java	(revision 8303)
+++ trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java	(revision 8304)
@@ -11,6 +11,4 @@
 import java.awt.Insets;
 import java.awt.event.ActionEvent;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
 import java.text.DateFormat;
 import java.util.Collections;
@@ -185,6 +183,6 @@
     }
 
-    protected static String getUserUrl(String username) throws UnsupportedEncodingException {
-        return Main.getBaseUserUrl() + "/" +  URLEncoder.encode(username, "UTF-8").replaceAll("\\+", "%20");
+    protected static String getUserUrl(String username) {
+        return Main.getBaseUserUrl() + "/" +  Utils.encodeUrl(username).replaceAll("\\+", "%20");
     }
 
@@ -209,12 +207,7 @@
             }
             lblUser.setDescription(username);
-            try {
-                if (user != null && user != User.getAnonymous()) {
-                    lblUser.setUrl(getUserUrl(username));
-                } else {
-                    lblUser.setUrl(null);
-                }
-            } catch(UnsupportedEncodingException e) {
-                Main.error(e);
+            if (user != null && user != User.getAnonymous()) {
+                lblUser.setUrl(getUserUrl(username));
+            } else {
                 lblUser.setUrl(null);
             }
@@ -226,10 +219,5 @@
             } else {
                 lblUser.setDescription(username);
-                try {
-                    lblUser.setUrl(getUserUrl(username));
-                } catch(UnsupportedEncodingException e) {
-                    Main.error(e);
-                    lblUser.setUrl(null);
-                }
+                lblUser.setUrl(getUserUrl(username));
             }
             lblChangeset.setDescription(tr("none"));
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java	(revision 8303)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java	(revision 8304)
@@ -3,5 +3,4 @@
 
 import java.awt.Color;
-import java.io.UnsupportedEncodingException;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -11,5 +10,4 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
@@ -801,9 +799,5 @@
          */
         public static String URL_encode(String s) {
-            try {
-                return s == null ? null : URLEncoder.encode(s, "UTF-8");
-            } catch (UnsupportedEncodingException ex) {
-                throw new RuntimeException(ex);
-            }
+            return s == null ? null : Utils.encodeUrl(s);
         }
 
Index: trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java	(revision 8303)
+++ trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java	(revision 8304)
@@ -9,10 +9,8 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Field;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
@@ -251,20 +249,16 @@
 
     protected String buildPostRequest(Map<String,String> parameters) throws OsmOAuthAuthorizationException {
-        try {
-            StringBuilder sb = new StringBuilder();
-
-            for(Iterator<Entry<String,String>> it = parameters.entrySet().iterator(); it.hasNext();) {
-                Entry<String,String> entry = it.next();
-                String value = entry.getValue();
-                value = (value == null) ? "" : value;
-                sb.append(entry.getKey()).append("=").append(URLEncoder.encode(value, "UTF-8"));
-                if (it.hasNext()) {
-                    sb.append("&");
-                }
-            }
-            return sb.toString();
-        } catch(UnsupportedEncodingException e) {
-            throw new OsmOAuthAuthorizationException(e);
-        }
+        StringBuilder sb = new StringBuilder();
+
+        for(Iterator<Entry<String,String>> it = parameters.entrySet().iterator(); it.hasNext();) {
+            Entry<String,String> entry = it.next();
+            String value = entry.getValue();
+            value = (value == null) ? "" : value;
+            sb.append(entry.getKey()).append("=").append(Utils.encodeUrl(value));
+            if (it.hasNext()) {
+                sb.append("&");
+            }
+        }
+        return sb.toString();
     }
 
Index: trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java	(revision 8303)
+++ 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 8303)
+++ 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 8303)
+++ 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 8303)
+++ 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 8303)
+++ 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)));
                         }
                     }
Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 8303)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 8304)
@@ -27,9 +27,6 @@
 import java.io.InputStream;
 import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URL;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
@@ -287,4 +284,5 @@
      *
      * (optional)
+     * @param archive zip file where the image is located
      * @return the current object, for convenience
      */
@@ -816,49 +814,45 @@
      */
     private static ImageResource getIfAvailableDataUrl(String url) {
-        try {
-            Matcher m = dataUrlPattern.matcher(url);
-            if (m.matches()) {
-                String mediatype = m.group(1);
-                String base64 = m.group(2);
-                String data = m.group(3);
-                byte[] bytes;
-                if (";base64".equals(base64)) {
-                    bytes = DatatypeConverter.parseBase64Binary(data);
-                } else {
-                    try {
-                        bytes = URLDecoder.decode(data, "UTF-8").getBytes(StandardCharsets.UTF_8);
-                    } catch (IllegalArgumentException ex) {
-                        Main.warn("Unable to decode URL data part: "+ex.getMessage() + " (" + data + ")");
-                        return null;
-                    }
-                }
-                if ("image/svg+xml".equals(mediatype)) {
-                    String s = new String(bytes, StandardCharsets.UTF_8);
-                    SVGDiagram svg = null;
-                    synchronized (getSvgUniverse()) {
-                        URI uri = getSvgUniverse().loadSVG(new StringReader(s), URLEncoder.encode(s, "UTF-8"));
-                        svg = getSvgUniverse().getDiagram(uri);
-                    }
-                    if (svg == null) {
-                        Main.warn("Unable to process svg: "+s);
-                        return null;
-                    }
-                    return new ImageResource(svg);
-                } else {
-                    try {
-                        // See #10479: for PNG files, always enforce transparency to be sure tNRS chunk is used even not in paletted mode
-                        // This can be removed if someday Oracle fixes https://bugs.openjdk.java.net/browse/JDK-6788458
-                        // hg.openjdk.java.net/jdk7u/jdk7u/jdk/file/828c4fedd29f/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java#l656
-                        Image img = read(new ByteArrayInputStream(bytes), false, true);
-                        return img == null ? null : new ImageResource(img);
-                    } catch (IOException e) {
-                        Main.warn("IOException while reading image: "+e.getMessage());
-                    }
-                }
-            }
-            return null;
-        } catch (UnsupportedEncodingException ex) {
-            throw new RuntimeException(ex.getMessage(), ex);
-        }
+        Matcher m = dataUrlPattern.matcher(url);
+        if (m.matches()) {
+            String mediatype = m.group(1);
+            String base64 = m.group(2);
+            String data = m.group(3);
+            byte[] bytes;
+            if (";base64".equals(base64)) {
+                bytes = DatatypeConverter.parseBase64Binary(data);
+            } else {
+                try {
+                    bytes = Utils.decodeUrl(data).getBytes(StandardCharsets.UTF_8);
+                } catch (IllegalArgumentException ex) {
+                    Main.warn("Unable to decode URL data part: "+ex.getMessage() + " (" + data + ")");
+                    return null;
+                }
+            }
+            if ("image/svg+xml".equals(mediatype)) {
+                String s = new String(bytes, StandardCharsets.UTF_8);
+                SVGDiagram svg = null;
+                synchronized (getSvgUniverse()) {
+                    URI uri = getSvgUniverse().loadSVG(new StringReader(s), Utils.encodeUrl(s));
+                    svg = getSvgUniverse().getDiagram(uri);
+                }
+                if (svg == null) {
+                    Main.warn("Unable to process svg: "+s);
+                    return null;
+                }
+                return new ImageResource(svg);
+            } else {
+                try {
+                    // See #10479: for PNG files, always enforce transparency to be sure tNRS chunk is used even not in paletted mode
+                    // This can be removed if someday Oracle fixes https://bugs.openjdk.java.net/browse/JDK-6788458
+                    // hg.openjdk.java.net/jdk7u/jdk7u/jdk/file/828c4fedd29f/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java#l656
+                    Image img = read(new ByteArrayInputStream(bytes), false, true);
+                    return img == null ? null : new ImageResource(img);
+                } catch (IOException e) {
+                    Main.warn("IOException while reading image: "+e.getMessage());
+                }
+            }
+        }
+        return null;
     }
 
Index: trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java	(revision 8303)
+++ trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java	(revision 8304)
@@ -6,6 +6,4 @@
 import java.awt.HeadlessException;
 import java.awt.Toolkit;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.HashMap;
 import java.util.Map;
@@ -26,7 +24,7 @@
             // a percent sign indicates an encoded URL (RFC 1738).
             if (url.contains("%")) {
-                url = URLDecoder.decode(url, "UTF-8");
-            }
-        } catch (UnsupportedEncodingException | IllegalArgumentException x) {
+                url = Utils.decodeUrl(url);
+            }
+        } catch (IllegalArgumentException x) {
             Main.error(x);
         }
Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 8303)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 8304)
@@ -25,4 +25,5 @@
 import java.net.URL;
 import java.net.URLConnection;
+import java.net.URLDecoder;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
@@ -1116,12 +1117,49 @@
                 sb.append(c);
             } else {
-                try {
-                    sb.append(URLEncoder.encode(c, "UTF-8"));
-                } catch (UnsupportedEncodingException ex) {
-                    throw new RuntimeException(ex);
-                }
+                sb.append(encodeUrl(c));
             }
         }
         return sb.toString();
+    }
+
+    /**
+     * Translates a string into <code>application/x-www-form-urlencoded</code>
+     * format. This method uses UTF-8 encoding scheme to obtain the bytes for unsafe
+     * characters.
+     *
+     * @param   s <code>String</code> to be translated.
+     * @return  the translated <code>String</code>.
+     * @see #decodeUrl(String)
+     * @since 8304
+     */
+    public static String encodeUrl(String s) {
+        final String enc = StandardCharsets.UTF_8.name();
+        try {
+            return URLEncoder.encode(s, enc);
+        } catch (UnsupportedEncodingException e) {
+            Main.error(e);
+            return null;
+        }
+    }
+
+    /**
+     * Decodes a <code>application/x-www-form-urlencoded</code> string.
+     * UTF-8 encoding is used to determine
+     * what characters are represented by any consecutive sequences of the
+     * form "<code>%<i>xy</i></code>".
+     *
+     * @param s the <code>String</code> to decode
+     * @return the newly decoded <code>String</code>
+     * @see #encodeUrl(String)
+     * @since 8304
+     */
+    public static String decodeUrl(String s) {
+        final String enc = StandardCharsets.UTF_8.name();
+        try {
+            return URLDecoder.decode(s, enc);
+        } catch (UnsupportedEncodingException e) {
+            Main.error(e);
+            return null;
+        }
     }
 
