diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2023-03-16 20:25:09 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2023-03-16 20:25:09 +0300 |
commit | 5da71b6059956a8f20a6be02e82867aa28aa3880 (patch) | |
tree | 863765444e82e047b4edf2783817fe3305652d09 /newlib/libc/locale | |
parent | 2285cf0d1ccd783cedc46463fe5c7cc55c6e29a4 (diff) |
Cygwin: add support for GB18030 codeset
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc/locale')
-rw-r--r-- | newlib/libc/locale/locale.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index e58ba3dbe..3772106e3 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -65,8 +65,8 @@ build with multibyte support and support for all ISO and Windows Codepage. Otherwise all singlebyte charsets are simply mapped to ASCII. Right now, only newlib for Cygwin is built with full charset support by default. Under Cygwin, this implementation additionally supports the charsets -<<"GBK">>, <<"GB2312">>, <<"eucCN">>, <<"eucKR">>, and <<"Big5">>. Cygwin -does not support <<"JIS">>. +<<"GB18030">>, <<"GBK">>, <<"GB2312">>, <<"eucCN">>, <<"eucKR">>, and +<<"Big5">>. Cygwin does not support <<"JIS">>. Cygwin additionally supports locales from the file /usr/share/locale/locale.alias. @@ -657,7 +657,7 @@ restart: } #ifdef __CYGWIN__ /* Newlib does neither provide EUC-KR nor EUC-CN, and Cygwin's - implementation requires Windows support. */ + implementation requires Windows support. */ else if (!strcasecmp (c, "KR")) { strcpy (charset, "EUCKR"); @@ -817,12 +817,19 @@ restart: requires Windows support. */ if (!strcasecmp (charset, "GBK") || !strcasecmp (charset, "GB2312")) - { + { strcpy (charset, charset[2] == '2' ? "GB2312" : "GBK"); mbc_max = 2; l_wctomb = __gbk_wctomb; l_mbtowc = __gbk_mbtowc; } + else if (!strcasecmp (charset, "GB18030")) + { + strcpy (charset, "GB18030"); + mbc_max = 4; + l_wctomb = __gb18030_wctomb; + l_mbtowc = __gb18030_mbtowc; + } else #endif /* __CYGWIN__ */ /* GEORGIAN-PS and the alias without dash */ |