1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2009-02-02 22:02:16 +00:00
parent 28155915a5
commit a1dd4a613a
2 changed files with 9 additions and 3 deletions

View file

@ -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++;