RFR: 8272352: Java launcher can not parse Chinese character when system locale is set to UTF-8 [v2]
Roger Riggs
rriggs at openjdk.java.net
Thu May 5 19:45:46 UTC 2022
On Tue, 3 May 2022 18:55:52 GMT, Naoto Sato <naoto at openjdk.org> wrote:
>> Java runtime has been detecting the Windows system locale encoding using `GetLocaleInfo(GetSystemDefaultLCID(), LOCALE_IDEFAULTANSICODEPAGE, ...)`, but it returns the *legacy* ANSI code page value, e.g, 1252 for US-English. In order to detect whether the user has selected `UTF-8` as the default, the code page has to be queried with `GetACP()`.
>> Also, the case if the call to `GetLocaleInfo` fails changed to fall back to `UTF-8` instead of `Cp1252`.
>
> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>
> Default to UTF-8 if malloc fails
Looks good.
src/java.base/windows/native/libjava/java_props_md.c line 695:
> 693: &display_encoding);
> 694:
> 695: sprops.sun_jnu_encoding = getEncodingInternal(0);
How should NULL from `getEncodingInternal` be handled? (only if malloc fails).
-------------
Marked as reviewed by rriggs (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/8434
More information about the core-libs-dev
mailing list