aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-03-16 18:25:09 +0100
committerCorinna Vinschen <corinna@vinschen.de>2023-03-16 18:25:09 +0100
commit5da71b6059956a8f20a6be02e82867aa28aa3880 (patch)
tree863765444e82e047b4edf2783817fe3305652d09 /newlib/libc
parent2285cf0d1ccd783cedc46463fe5c7cc55c6e29a4 (diff)
downloadnewlib-5da71b6059956a8f20a6be02e82867aa28aa3880.zip
newlib-5da71b6059956a8f20a6be02e82867aa28aa3880.tar.gz
newlib-5da71b6059956a8f20a6be02e82867aa28aa3880.tar.bz2
Cygwin: add support for GB18030 codeset
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/locale/locale.c15
-rw-r--r--newlib/libc/stdlib/local.h2
2 files changed, 13 insertions, 4 deletions
diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c
index e58ba3d..3772106 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 */
diff --git a/newlib/libc/stdlib/local.h b/newlib/libc/stdlib/local.h
index a96ed2c..26fd4f0 100644
--- a/newlib/libc/stdlib/local.h
+++ b/newlib/libc/stdlib/local.h
@@ -24,6 +24,7 @@ wctomb_p __iso_wctomb (int val);
wctomb_p __cp_wctomb (int val);
#ifdef __CYGWIN__
wctomb_f __gbk_wctomb;
+wctomb_f __gb18030_wctomb;
wctomb_f __kr_wctomb;
wctomb_f __big5_wctomb;
#endif
@@ -45,6 +46,7 @@ mbtowc_p __iso_mbtowc (int val);
mbtowc_p __cp_mbtowc (int val);
#ifdef __CYGWIN__
mbtowc_f __gbk_mbtowc;
+mbtowc_f __gb18030_mbtowc;
mbtowc_f __kr_mbtowc;
mbtowc_f __big5_mbtowc;
#endif