aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/locale
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-01-24 12:18:20 +0000
committerCorinna Vinschen <corinna@vinschen.de>2010-01-24 12:18:20 +0000
commit88116ad22eab8c3b4987949e5f94040834ad1833 (patch)
tree09b15a8bac10b7453cd1937277480e1556d5ce6a /newlib/libc/locale
parent96697c23e43d0138fb1754c3ddc210ae1e954be4 (diff)
downloadnewlib-88116ad22eab8c3b4987949e5f94040834ad1833.zip
newlib-88116ad22eab8c3b4987949e5f94040834ad1833.tar.gz
newlib-88116ad22eab8c3b4987949e5f94040834ad1833.tar.bz2
* libc/locale/nl_langinfo.c (nl_langinfo): Return "CP932" when using
SJIS on Cygwin. Explain why.
Diffstat (limited to 'newlib/libc/locale')
-rw-r--r--newlib/libc/locale/nl_langinfo.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/newlib/libc/locale/nl_langinfo.c b/newlib/libc/locale/nl_langinfo.c
index ae7228c..cd86c15 100644
--- a/newlib/libc/locale/nl_langinfo.c
+++ b/newlib/libc/locale/nl_langinfo.c
@@ -79,6 +79,20 @@ _DEFUN(nl_langinfo, (item),
else if (strcmp (ret + 2, "21866") == 0)
ret = "KOI8-U";
}
+ else if (ret[0] == 'S'/*JIS*/)
+ {
+ /* Cygwin uses MSFT's implementation of SJIS, which differs
+ in some codepoints from the real thing, especially
+ 0x5c: yen sign instead of backslash,
+ 0x7e: overline instead of tilde.
+ We can't use the real SJIS since otherwise Win32
+ pathnames would become invalid. OTOH, if we return
+ "SJIS" here, then libiconv will do mb<->wc conversion
+ differently to our internal functions. Therefore we
+ return what we really implement, CP932. This is handled
+ fine by libiconv. */
+ ret = "CP932";
+ }
#else
ret = "";
if ((s = setlocale(LC_CTYPE, NULL)) != NULL) {