src/java.base/share/classes/sun/launcher/LauncherHelper.java

Print this page

        

*** 587,607 **** --- 587,618 ---- mainMethod.getDeclaringClass().getName()); } } private static final String encprop = "sun.jnu.encoding"; + private static final String encprop_unicode = "file.encoding.unicode"; private static String encoding = null; private static boolean isCharsetSupported = false; /* * converts a c or a byte array to a platform specific string, * previously implemented as a native method in the launcher. */ static String makePlatformString(boolean printToStderr, byte[] inArray) { initOutput(printToStderr); if (encoding == null) { + if (Boolean.getBoolean("windows.UnicodeConsole")) { + encoding = System.getProperty(encprop_unicode); + if (encoding == null || !Charset.isSupported(encoding)) { + encoding = Charset.defaultUnicodeCharset().name(); + } + if (!Charset.isSupported(encoding)) { + encoding = System.getProperty(encprop); + } + } else { encoding = System.getProperty(encprop); + } isCharsetSupported = Charset.isSupported(encoding); } try { String out = isCharsetSupported ? new String(inArray, encoding)