On Mon, 4 Jan 2021 09:25:55 GMT, Yasumasa Suenaga <ysuen...@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. This pull request has now been integrated. Changeset: 67c22114 Author: Yasumasa Suenaga <ysuen...@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/67c22114 Stats: 49 lines in 2 files changed: 4 ins; 37 del; 8 mod 8259045: Exception message from saproc.dll is garbled on Windows with Japanese locale Reviewed-by: erikj, cjplummer, iklam ------------- PR: https://git.openjdk.java.net/jdk/pull/1928