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

* encoding.c (rb_locale_charmap): return nil if no locale information.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-12-21 04:09:45 +00:00
parent 5a717c35ea
commit 8c68d9a152
3 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Fri Dec 21 13:09:11 2007 Tanaka Akira <akr@fsij.org>
* encoding.c (rb_locale_charmap): return nil if no locale information.
Fri Dec 21 12:55:39 2007 Tanaka Akira <akr@fsij.org>
* lib/runit, lib/rubyunit.rb, test/testunit/runit: removed.

View file

@ -714,7 +714,7 @@ rb_locale_charmap(VALUE klass)
codeset = nl_langinfo(CODESET);
return rb_str_new2(codeset);
#else
return rb_str_new2("ASCII-8BIT");
return Qnil;
#endif
}

5
ruby.c
View file

@ -139,9 +139,12 @@ static rb_encoding *
locale_encoding(void)
{
VALUE codeset = rb_locale_charmap(Qnil);
char *name = StringValueCStr(codeset);
char *name;
int idx;
if (codeset == Qnil)
return rb_default_encoding();
idx = rb_enc_find_index(name);
if (idx < 0)
return rb_default_encoding();