changeset 42211:ac4e6dc2d20f

8165680: [macosx] Enhance handling of UTF-8 characters in CDataTransfer.java Reviewed-by: serb, aniyogi Contributed-by: manajit.halder@oracle.com
author mhalder
date Fri, 11 Nov 2016 13:58:42 +0530
parents 7acd39aaf16f
children e5662f6598d4
files jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Fri Nov 11 12:40:59 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Fri Nov 11 13:58:42 2016 +0530
@@ -38,6 +38,7 @@
 import java.util.*;
 import java.util.regex.*;
 import java.awt.datatransfer.*;
+import java.nio.charset.StandardCharsets;
 import sun.awt.datatransfer.*;
 
 public class CDataTransferer extends DataTransferer {
@@ -132,7 +133,7 @@
             String charset = Charset.defaultCharset().name();
             if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
                 try {
-                    charset = new String((byte[]) transferable.getTransferData(javaTextEncodingFlavor), "UTF-8");
+                    charset = new String((byte[]) transferable.getTransferData(javaTextEncodingFlavor), StandardCharsets.UTF_8);
                 } catch (UnsupportedFlavorException cannotHappen) {
                 }
             }