summaryrefslogtreecommitdiffstats
path: root/encoding.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-28 10:41:52 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-28 10:41:52 +0000
commit7d8e9944917a523a0646d38e945542be71377a30 (patch)
treead6c02a087ecc6805fb34ca6120e475e291b150e /encoding.c
parent009d277aeb72c2b7e8d338f8dc80ab8206d61339 (diff)
downloadruby-7d8e9944917a523a0646d38e945542be71377a30.tar.gz
ruby-7d8e9944917a523a0646d38e945542be71377a30.tar.xz
ruby-7d8e9944917a523a0646d38e945542be71377a30.zip
* encoding.c (rb_locale_encoding): should check return value from
rb_locale_charmap(). * ruby.c (locale_encoding): removed. * ruby.c (process_options): use rb_locale_encoding() instead of locale_encoding(). * ext/readline/readline.c (readline_readline): use locale encoding instead of input IO's encoding. [ruby-dev:32872] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/encoding.c b/encoding.c
index adbad670f..ac47b9c15 100644
--- a/encoding.c
+++ b/encoding.c
@@ -857,8 +857,12 @@ rb_encoding *
rb_locale_encoding(void)
{
VALUE charmap = rb_locale_charmap(rb_cEncoding);
- int idx = rb_enc_find_index(StringValueCStr(charmap));
+ int idx;
+
+ if (NIL_P(charmap))
+ return rb_ascii8bit_encoding();
+ idx = rb_enc_find_index(StringValueCStr(charmap));
if (idx < 0)
return rb_ascii8bit_encoding();