* libc/locale/locale.c (loadlocale): Optimize "EUC" charset check.
Cygwin only: Allow GB2312 and EUC-CN as alternative codeset names for GBK. Add to documentation. * libc/locale/nl_langinfo.c (nl_langinfo): On Cygwin, translate EUCCN to GB2312.
This commit is contained in:
parent
8a3cfef325
commit
eca2df4f01
|
@ -1,3 +1,11 @@
|
||||||
|
2010-03-27 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* libc/locale/locale.c (loadlocale): Optimize "EUC" charset check.
|
||||||
|
Cygwin only: Allow GB2312 and EUC-CN as alternative codeset names
|
||||||
|
for GBK. Add to documentation.
|
||||||
|
* libc/locale/nl_langinfo.c (nl_langinfo): On Cygwin, translate EUCCN
|
||||||
|
to GB2312.
|
||||||
|
|
||||||
2010-03-17 Craig Howland <howland@LGSInnovations.com>
|
2010-03-17 Craig Howland <howland@LGSInnovations.com>
|
||||||
|
|
||||||
* libc/include/sys/features.h: Allow for _XOPEN_SOURCE to have an
|
* libc/include/sys/features.h: Allow for _XOPEN_SOURCE to have an
|
||||||
|
|
|
@ -81,7 +81,8 @@ build with multibyte support and support for all ISO and Windows Codepage.
|
||||||
Otherwise all singlebyte charsets are simply mapped to ASCII. Right now,
|
Otherwise all singlebyte charsets are simply mapped to ASCII. Right now,
|
||||||
only newlib for Cygwin is built with full charset support by default.
|
only newlib for Cygwin is built with full charset support by default.
|
||||||
Under Cygwin, this implementation additionally supports the charsets
|
Under Cygwin, this implementation additionally supports the charsets
|
||||||
<<"GBK">>, <<"eucKR">>, and <<"Big5">>. Cygwin does not support <<"JIS">>.
|
<<"GBK">>, <<"GB2312">>, <<"eucCN">>, <<"eucKR">>, and <<"Big5">>. Cygwin
|
||||||
|
does not support <<"JIS">>.
|
||||||
|
|
||||||
Cygwin additionally supports locales from the file
|
Cygwin additionally supports locales from the file
|
||||||
/usr/share/locale/locale.alias.
|
/usr/share/locale/locale.alias.
|
||||||
|
@ -587,7 +588,12 @@ restart:
|
||||||
#endif /* !__CYGWIN__ */
|
#endif /* !__CYGWIN__ */
|
||||||
case 'E':
|
case 'E':
|
||||||
case 'e':
|
case 'e':
|
||||||
if (!strcasecmp (charset, "EUCJP") || !strcasecmp (charset, "EUC-JP"))
|
if (strncasecmp (charset, "EUC", 3))
|
||||||
|
FAIL;
|
||||||
|
c = charset + 3;
|
||||||
|
if (*c == '-')
|
||||||
|
++c;
|
||||||
|
if (!strcasecmp (c, "JP"))
|
||||||
{
|
{
|
||||||
strcpy (charset, "EUCJP");
|
strcpy (charset, "EUCJP");
|
||||||
mbc_max = 3;
|
mbc_max = 3;
|
||||||
|
@ -595,16 +601,22 @@ restart:
|
||||||
l_mbtowc = __eucjp_mbtowc;
|
l_mbtowc = __eucjp_mbtowc;
|
||||||
}
|
}
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
/* Newlib does not provide EUC-KR and Cygwin's implementation
|
/* Newlib does neither provide EUC-KR nor EUC-CN, and Cygwin's
|
||||||
requires Windows support. */
|
implementation requires Windows support. */
|
||||||
else if (!strcasecmp (charset, "EUCKR")
|
else if (!strcasecmp (c, "KR"))
|
||||||
|| !strcasecmp (charset, "EUC-KR"))
|
|
||||||
{
|
{
|
||||||
strcpy (charset, "EUCKR");
|
strcpy (charset, "EUCKR");
|
||||||
mbc_max = 2;
|
mbc_max = 2;
|
||||||
l_wctomb = __kr_wctomb;
|
l_wctomb = __kr_wctomb;
|
||||||
l_mbtowc = __kr_mbtowc;
|
l_mbtowc = __kr_mbtowc;
|
||||||
}
|
}
|
||||||
|
else if (!strcasecmp (c, "CN"))
|
||||||
|
{
|
||||||
|
strcpy (charset, "EUCCN");
|
||||||
|
mbc_max = 2;
|
||||||
|
l_wctomb = __gbk_wctomb;
|
||||||
|
l_mbtowc = __gbk_mbtowc;
|
||||||
|
}
|
||||||
#endif /* __CYGWIN__ */
|
#endif /* __CYGWIN__ */
|
||||||
else
|
else
|
||||||
FAIL;
|
FAIL;
|
||||||
|
@ -735,11 +747,12 @@ restart:
|
||||||
case 'G':
|
case 'G':
|
||||||
case 'g':
|
case 'g':
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
/* Newlib does not provide GBK and Cygwin's implementation
|
/* Newlib does not provide GBK/GB2312 and Cygwin's implementation
|
||||||
requires Windows support. */
|
requires Windows support. */
|
||||||
if (!strcasecmp (charset, "GBK"))
|
if (!strcasecmp (charset, "GBK")
|
||||||
|
|| !strcasecmp (charset, "GB2312"))
|
||||||
{
|
{
|
||||||
strcpy (charset, "GBK");
|
strcpy (charset, charset[2] == '2' ? "GB2312" : "GBK");
|
||||||
mbc_max = 2;
|
mbc_max = 2;
|
||||||
l_wctomb = __gbk_wctomb;
|
l_wctomb = __gbk_wctomb;
|
||||||
l_mbtowc = __gbk_mbtowc;
|
l_mbtowc = __gbk_mbtowc;
|
||||||
|
|
|
@ -69,6 +69,8 @@ _DEFUN(nl_langinfo, (item),
|
||||||
ret = "EUC-JP";
|
ret = "EUC-JP";
|
||||||
else if (strcmp (ret, "EUCKR") == 0)
|
else if (strcmp (ret, "EUCKR") == 0)
|
||||||
ret = "EUC-KR";
|
ret = "EUC-KR";
|
||||||
|
else if (strcmp (ret, "EUCCN") == 0)
|
||||||
|
ret = "GB2312";
|
||||||
}
|
}
|
||||||
else if (ret[0] == 'C'/*Pxxxx*/)
|
else if (ret[0] == 'C'/*Pxxxx*/)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue