ruby-changes:17433
From: naruse <ko1@a...>
Date: Mon, 11 Oct 2010 14:15:10 +0900 (JST)
Subject: [ruby-changes:17433] Ruby:r29438 (trunk): * error.c (syserr_initialize): set the encoding of Errno::*#message
naruse 2010-10-11 14:15:03 +0900 (Mon, 11 Oct 2010) New Revision: 29438 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29438 Log: * error.c (syserr_initialize): set the encoding of Errno::*#message as locale. [ruby-dev:42358] Modified files: trunk/ChangeLog trunk/error.c trunk/test/ruby/test_exception.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 29437) +++ ChangeLog (revision 29438) @@ -1,3 +1,8 @@ +Mon Oct 11 14:03:54 2010 NARUSE, Yui <naruse@r...> + + * error.c (syserr_initialize): set the encoding of Errno::*#message + as locale. [ruby-dev:42358] + Mon Oct 11 06:38:27 2010 NARUSE, Yui <naruse@r...> * ext/stringio/stringio.c (strio_set_encoding): Index: error.c =================================================================== --- error.c (revision 29437) +++ error.c (revision 29438) @@ -1057,6 +1057,7 @@ 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; Index: test/ruby/test_exception.rb =================================================================== --- test/ruby/test_exception.rb (revision 29437) +++ test/ruby/test_exception.rb (revision 29438) @@ -312,4 +312,8 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/