RFR: 8337506: Disable "best-fit" mapping on Windows command line
Alan Bateman
alanb at openjdk.org
Fri Aug 2 09:33:36 UTC 2024
On Thu, 1 Aug 2024 17:21:09 GMT, Naoto Sato <naoto at openjdk.org> wrote:
> Fixing the Java launcher's command line argument parsing issue on Windows. The Java launcher on Windows has been using `GetCommandLineA()` to obtain arguments, which by default does "best-fit" mapping when the arguments are converted to ANSI code page encoding. By disabling this "best-fit" mapping, the launcher's parsing works as expected. A corresponding CSR has been drafted for the behavioral change.
src/java.base/share/native/launcher/main.c line 121:
> 119: wcCmdline, -1, NULL, 0, NULL, NULL);
> 120: LPSTR mbCmdline = JLI_MemAlloc(mbSize);
> 121: if (WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS | WC_COMPOSITECHECK | WC_DEFAULTCHAR,
I think this looks okay but will need to handle GetCommandLineW, WideCharToMultiByte, or JLI_MemAlloc failing.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20428#discussion_r1701589380
More information about the hotspot-runtime-dev
mailing list