changeset 14598:3d1f56602d93

8139216: Non-ASCII characters in CUPS printer names are not properly displayed Reviewed-by: prr, rchamyal
author psadhukhan
date Tue, 03 Nov 2015 14:00:01 +0300
parents acc830bc39a1
children af37c3fb97fd
files src/java.desktop/unix/classes/sun/print/IPPPrintService.java
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/unix/classes/sun/print/IPPPrintService.java	Mon Nov 02 17:52:40 2015 +0400
+++ b/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;