On Tue, 5 Jan 2021 03:19:51 GMT, Ioi Lam <ik...@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