* 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:
parent
5a717c35ea
commit
8c68d9a152
@ -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>
|
Fri Dec 21 12:55:39 2007 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* lib/runit, lib/rubyunit.rb, test/testunit/runit: removed.
|
* lib/runit, lib/rubyunit.rb, test/testunit/runit: removed.
|
||||||
|
@ -714,7 +714,7 @@ rb_locale_charmap(VALUE klass)
|
|||||||
codeset = nl_langinfo(CODESET);
|
codeset = nl_langinfo(CODESET);
|
||||||
return rb_str_new2(codeset);
|
return rb_str_new2(codeset);
|
||||||
#else
|
#else
|
||||||
return rb_str_new2("ASCII-8BIT");
|
return Qnil;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
ruby.c
5
ruby.c
@ -139,9 +139,12 @@ static rb_encoding *
|
|||||||
locale_encoding(void)
|
locale_encoding(void)
|
||||||
{
|
{
|
||||||
VALUE codeset = rb_locale_charmap(Qnil);
|
VALUE codeset = rb_locale_charmap(Qnil);
|
||||||
char *name = StringValueCStr(codeset);
|
char *name;
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
|
if (codeset == Qnil)
|
||||||
|
return rb_default_encoding();
|
||||||
|
|
||||||
idx = rb_enc_find_index(name);
|
idx = rb_enc_find_index(name);
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
return rb_default_encoding();
|
return rb_default_encoding();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user