From dcc316b825abf8b9b975e6318b7aef904d686801 Mon Sep 17 00:00:00 2001 From: yugui Date: Thu, 2 Dec 2010 08:06:29 +0000 Subject: [PATCH] merges r29438 from trunk into ruby_1_9_2. -- * error.c (syserr_initialize): set the encoding of Errno::*#message as locale. [ruby-dev:42358] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ error.c | 1 + test/ruby/test_exception.rb | 4 ++++ version.h | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index acc292c73f..92bed7b945 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Oct 11 14:03:54 2010 NARUSE, Yui + + * error.c (syserr_initialize): set the encoding of Errno::*#message + as locale. [ruby-dev:42358] + Mon Oct 11 06:11:30 2010 NARUSE, Yui * io.c (rb_io_set_encoding): use rb_funcall2 when the io is not diff --git a/error.c b/error.c index 0e1eab0a77..350cb018a6 100644 --- a/error.c +++ b/error.c @@ -1045,6 +1045,7 @@ syserr_initialize(int argc, VALUE *argv, VALUE self) else { mesg = rb_str_new2(err); } + rb_enc_associate(mesg, rb_locale_encoding()); rb_call_super(1, &mesg); rb_iv_set(self, "errno", error); return self; diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 18ecb404be..a26ade075b 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -312,4 +312,8 @@ end.join e = assert_raise(NoMethodError) {str.__send__(id)} assert_equal("undefined method `#{id}' for #{str.inspect}:String", e.message, bug3237) end + + def test_errno + assert_equal(Encoding.find("locale"), Errno::EINVAL.new.message.encoding) + end end diff --git a/version.h b/version.h index 70cbba1563..1344155706 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 65 +#define RUBY_PATCHLEVEL 66 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1