From 7d8e9944917a523a0646d38e945542be71377a30 Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 28 Dec 2007 10:41:52 +0000 Subject: * 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 --- encoding.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'encoding.c') 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(); -- cgit