mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8272352: Java launcher can not parse Chinese character when system locale is set to UTF-8
Reviewed-by: rriggs
This commit is contained in:
parent
1bba64070e
commit
2293448531
1 changed files with 11 additions and 9 deletions
|
@ -63,18 +63,18 @@ static boolean SetupI18nProps(LCID lcid, char** language, char** script, char**
|
||||||
static char *
|
static char *
|
||||||
getEncodingInternal(LCID lcid)
|
getEncodingInternal(LCID lcid)
|
||||||
{
|
{
|
||||||
int codepage;
|
int codepage = 0;
|
||||||
char * ret = malloc(16);
|
char * ret = malloc(16);
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetLocaleInfo(lcid,
|
if (lcid == 0) { // for sun.jnu.encoding
|
||||||
|
codepage = GetACP();
|
||||||
|
_itoa_s(codepage, ret + 2, 14, 10);
|
||||||
|
} else if (GetLocaleInfo(lcid,
|
||||||
LOCALE_IDEFAULTANSICODEPAGE,
|
LOCALE_IDEFAULTANSICODEPAGE,
|
||||||
ret+2, 14) == 0) {
|
ret + 2, 14) != 0) {
|
||||||
codepage = 1252;
|
|
||||||
strcpy(ret+2, "1252");
|
|
||||||
} else {
|
|
||||||
codepage = atoi(ret + 2);
|
codepage = atoi(ret + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -660,7 +660,6 @@ GetJavaProperties(JNIEnv* env)
|
||||||
* (which is a Windows LCID value),
|
* (which is a Windows LCID value),
|
||||||
*/
|
*/
|
||||||
LCID userDefaultLCID = GetUserDefaultLCID();
|
LCID userDefaultLCID = GetUserDefaultLCID();
|
||||||
LCID systemDefaultLCID = GetSystemDefaultLCID();
|
|
||||||
LANGID userDefaultUILang = GetUserDefaultUILanguage();
|
LANGID userDefaultUILang = GetUserDefaultUILanguage();
|
||||||
LCID userDefaultUILCID = MAKELCID(userDefaultUILang, SORTIDFROMLCID(userDefaultLCID));
|
LCID userDefaultUILCID = MAKELCID(userDefaultUILang, SORTIDFROMLCID(userDefaultLCID));
|
||||||
|
|
||||||
|
@ -693,7 +692,10 @@ GetJavaProperties(JNIEnv* env)
|
||||||
&sprops.display_variant,
|
&sprops.display_variant,
|
||||||
&display_encoding);
|
&display_encoding);
|
||||||
|
|
||||||
sprops.sun_jnu_encoding = getEncodingInternal(systemDefaultLCID);
|
sprops.sun_jnu_encoding = getEncodingInternal(0);
|
||||||
|
if (sprops.sun_jnu_encoding == NULL) {
|
||||||
|
sprops.sun_jnu_encoding = "UTF-8";
|
||||||
|
}
|
||||||
if (LANGIDFROMLCID(userDefaultLCID) == 0x0c04 && majorVersion == 6) {
|
if (LANGIDFROMLCID(userDefaultLCID) == 0x0c04 && majorVersion == 6) {
|
||||||
// MS claims "Vista has built-in support for HKSCS-2004.
|
// MS claims "Vista has built-in support for HKSCS-2004.
|
||||||
// All of the HKSCS-2004 characters have Unicode 4.1.
|
// All of the HKSCS-2004 characters have Unicode 4.1.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue