From a1dd4a613a521dd4250c26b1aab7e40f49b0d4e9 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 2 Feb 2009 22:02:16 +0000 Subject: * missing/langinfo.c (nl_langinfo_codeset): accepts iso-8859 fragment. [ruby-core:21757] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- missing/langinfo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'missing/langinfo.c') diff --git a/missing/langinfo.c b/missing/langinfo.c index a76000bc77..6373afd0f5 100644 --- a/missing/langinfo.c +++ b/missing/langinfo.c @@ -63,6 +63,7 @@ const char * nl_langinfo_codeset(void) { const char *l, *p; + int n; if (((l = getenv("LC_ALL")) && *l) || ((l = getenv("LC_CTYPE")) && *l) || @@ -75,9 +76,9 @@ nl_langinfo_codeset(void) if (!p++) p = l; if (strstart(p, "UTF")) return "UTF-8"; - if (strstart(p, "8859-")) { - if (digit(p[5])) { - p += 5; + if ((n = 5, strstart(p, "8859-")) || (n = 9, strstart(p, "ISO-8859-"))) { + if (digit(p[n])) { + p += n; memcpy(buf, "ISO-8859-\0\0", 12); buf[9] = *p++; if (digit(*p)) buf[10] = *p++; -- cgit v1.2.3