RFR: 8259045: Exception message from saproc.dll is garbled on Windows with Japanese locale
Chris Plummer
cjplummer at openjdk.java.net
Wed Jan 6 17:38:56 UTC 2021
On Mon, 4 Jan 2021 09:25:55 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
> I got garbled exception message as following when I run `livenmethods` CLHSDB command:
>
> sun.jvm.hotspot.debugger.DebuggerException : ?w???????W
>
> My Windows laptop is set Japanese Locale, garbled message was written in Japanese.
> saproc.dll would throw exception via [ThrowNew()](https://docs.oracle.com/en/java/javase/15/docs/specs/jni/functions.html#thrownew) JNI function, but it accepts UTF-8 encoded message. However [FormatMessage()](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-formatmessage) Windows API might not return UTF-8 encoded string on Japanese locale.
>
> java.dll (libjava,so) provides good functions to resolve this issue. We can convert localized (non ascii) chars to UTF-8 string. I use them in this PR and remove `FormatMessage()` call from sadis.c.
> And also I remove `-D_MBCS` from compiler option because [MBCS has been already deprecated](https://docs.microsoft.com/ja-jp/cpp/text/support-for-multibyte-character-sets-mbcss) - it does not seem to add to any other executables.
Marked as reviewed by cjplummer (Reviewer).
-------------
PR: https://git.openjdk.java.net/jdk/pull/1928
More information about the build-dev
mailing list