8139216: Non-ASCII characters in CUPS printer names are not properly displayed
authorpsadhukhan
Tue, 03 Nov 2015 14:00:01 +0300
changeset 33860 f75ee0470f4b
parent 33859 3eb537b6bec0
child 33861 9ef7bafa3427
8139216: Non-ASCII characters in CUPS printer names are not properly displayed Reviewed-by: prr, rchamyal
jdk/src/java.desktop/unix/classes/sun/print/IPPPrintService.java
--- a/jdk/src/java.desktop/unix/classes/sun/print/IPPPrintService.java	Mon Nov 02 17:52:40 2015 +0400
+++ b/jdk/src/java.desktop/unix/classes/sun/print/IPPPrintService.java	Tue Nov 03 14:00:01 2015 +0300
@@ -321,7 +321,11 @@
         if ((name == null) || (url == null)){
             throw new IllegalArgumentException("null uri or printer name");
         }
-        printer = name;
+        try {
+            printer = java.net.URLDecoder.decode(name, "UTF-8");
+        } catch (java.io.UnsupportedEncodingException e) {
+            printer = name;
+        }
         supportedDocFlavors = null;
         supportedCats = null;
         mediaSizeNames = null;
@@ -351,7 +355,11 @@
         if ((name == null) || (uriStr == null)){
             throw new IllegalArgumentException("null uri or printer name");
         }
-        printer = name;
+        try {
+            printer = java.net.URLDecoder.decode(name, "UTF-8");
+        } catch (java.io.UnsupportedEncodingException e) {
+            printer = name;
+        }
         supportedDocFlavors = null;
         supportedCats = null;
         mediaSizeNames = null;