RFR: 8259045: Exception message from saproc.dll is garbled on Windows with Japanese locale

Yasumasa Suenaga ysuenaga at openjdk.java.net
Tue Jan 5 04:20:57 UTC 2021


On Tue, 5 Jan 2021 03:19:51 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> > Given that this seems to be a common problem in our code, and likely a very very old problem at that, why has it never been reported before? I'm not questioning the fix except to the extent that I'm questioning our understanding of the problem.
> 
> I think it's probably because the errors only happen in very rare cases. For example, when a DLL is missing from the JAVA_HOME. For more common cases, such as Process_impl.c, the code has been rewritten to use FormatMessageW, which is unicode.

In addition, this problem can be seen on non-ASCII locales such as CJK, so I guess many people overlooked it.
And also I think it is not just a problem on Windows because some older Linux machines on Japan set locale to EUC JP.

In case of ProcessImpl_md.c which @iklam pointed, result of `FormatMessageW()` which is encoded WideString (UTF-16) will be converted to UTF-8 with `WideCharToMultiByte()` at `win32Error()`, so it should work fine.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1928



More information about the build-dev mailing list