Java cmdline encoding challenges on Windows
Martin Sawicki (MS OPEN TECH)
marcins at microsoft.com
Tue Jan 27 17:21:12 UTC 2015
We're proposing an improvement to the OpenJDK intended to fix the currently existing problem with handling Unicode parameters on the command line in Windows (via cmd.exe), which prevents users for example in China from properly passing text strings in their own language via the java.exe command line.
We have a code submission figured out and tested internally. I've uploaded our webrev package here:
The crux of the change lies in using the "W" (wide character) version of the Windows APIs for fetching the command line parameters, rather than the "A" (ascii) version. But this code path is taken only when the following options are set:
-Dwindows.UnicodeConsole=true - switches on Unicode support in the Windows console
-Dfile.encoding.unicode="UTF-8" - identifies Unicode charset to use; If not specified, UTF-8 is used by default. Ignored when windows.UnicodeConsole is not set to true.
We'd appreciate a review and acceptance of this improvement.
And, as this is our first contribution to this sub-project within the OpenJDK, I apologize for any steps in the submission process that I may have missed here and would appreciate guidance as needed.
Martin Sawicki (and Kirk Shoop, and Valeriy Kopylov)
Microsoft Open Technologies, Inc.
A subsidiary of Microsoft Corp.
More information about the core-libs-dev