Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-01-20 16:18:24 +0300
committerCorinna Vinschen <corinna@vinschen.de>2010-01-20 16:18:24 +0300
commit514329a7ec70323b8e0810ece3092ab6537ca330 (patch)
tree6d04bd7da3830374b8a1f4914640200f69420ffb /newlib
parent044cd635339556d9876d322e858a6b96af9ce509 (diff)
* libc/locale/nl_langinfo.c (nl_langinfo): On Cygwin, translate
often-used charsets into Linux compatible codesets.
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog5
-rw-r--r--newlib/libc/locale/nl_langinfo.c25
2 files changed, 24 insertions, 6 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 7ff327b9c..b8c04ce2b 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-20 Corinna Vinschen <corinna@vinschen.de>
+
+ * libc/locale/nl_langinfo.c (nl_langinfo): On Cygwin, translate
+ often-used charsets into Linux compatible codesets.
+
2010-01-19 Andy Koppe <andy.koppe@gmail.com>
* libc/stdio/vfscanf.c (__SVFSCANF_R): Fix handling of non-ASCII
diff --git a/newlib/libc/locale/nl_langinfo.c b/newlib/libc/locale/nl_langinfo.c
index 1bc7c17e2..550f92efd 100644
--- a/newlib/libc/locale/nl_langinfo.c
+++ b/newlib/libc/locale/nl_langinfo.c
@@ -60,12 +60,25 @@ _DEFUN(nl_langinfo, (item),
case CODESET:
#ifdef __CYGWIN__
ret = __locale_charset ();
- /* Temporary exception for KOI8 charsets which are
- incorrectly treated by calling applications otherwise. */
- if (strcmp (ret, "CP20866") == 0)
- ret = "KOI8-R";
- else if (strcmp (ret, "CP21866") == 0)
- ret = "KOI8-U";
+ /* Convert charset to Linux compatible codeset string. */
+ if (ret[0] == 'A'/*SCII*/)
+ ret = "ANSI_X3.4-1968";
+ else if (ret[0] == 'E')
+ {
+ if (strcmp (ret, "EUCJP") == 0)
+ ret = "EUC-JP";
+ else if (strcmp (ret, "EUCKR") == 0)
+ ret = "EUC-KR";
+ }
+ else if (ret[0] == 'C'/*Pxxxx*/)
+ {
+ if (strcmp (ret + 2, "874") == 0)
+ ret = "TIS-620";
+ else if (strcmp (ret + 2, "20866") == 0)
+ ret = "KOI8-R";
+ else if (strcmp (ret + 2, "21866") == 0)
+ ret = "KOI8-U";
+ }
#else
ret = "";
if ((s = setlocale(LC_CTYPE, NULL)) != NULL) {