Windows command line processing

Salter, Thomas A Thomas.Salter at
Thu May 23 13:59:53 UTC 2013

I've observed issues with passing non-ASCII characters through the command  line to a Java program on Windows.  It seems that even though I can invoke java.exe through CreateProcess, passing a full range of Unicode characters, and even though the Java main accepts strings of Unicode characters, the launcher's C main function converts the Unicode to the local ANSI code page.  Thus any characters not in the local code page are lost.  This seems like a bug to me.

As a proof of concept, I changed jdk/src/share/bin/main.c to call GetCommanLineW instead of GetCommandLine, and then converted that string to UTF-8.  For my test, I set sun.jnu.encoding to UTF-8 so that makePlatformString in LauncherHelper would just work.

Tom Salter  |  Software Engineer  |  Java & Middleware Development 
Unisys  |  2476 Swedesford Road  |  Malvern, PA  19355   |  610-648-2568 |  N385-2568 

More information about the core-libs-dev mailing list