ruby-changes:26228
From: nari <ko1@a...>
Date: Mon, 10 Dec 2012 11:07:02 +0900 (JST)
Subject: [ruby-changes:26228] nari:r38285 (trunk): * lib/irb/magic-file.rb: set a encoding, which is detected from
nari 2012-12-10 11:06:51 +0900 (Mon, 10 Dec 2012) New Revision: 38285 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38285 Log: * lib/irb/magic-file.rb: set a encoding, which is detected from the file to read, to the internal encoding. [Bug #4281][ruby-dev:43036] Modified files: trunk/ChangeLog trunk/lib/irb/magic-file.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38284) +++ ChangeLog (revision 38285) @@ -1,3 +1,9 @@ +Mon Dec 10 10:36:12 2012 Narihiro Nakamura <authornari@g...> + + * lib/irb/magic-file.rb: set a encoding, which is detected from + the file to read, to the internal encoding. + [Bug #4281][ruby-dev:43036] + Mon Dec 10 09:40:19 2012 Eric Hodel <drbrain@s...> * lib/rubygems/ext/cmake_builder.rb: Added a builder for cmake. Index: lib/irb/magic-file.rb =================================================================== --- lib/irb/magic-file.rb (revision 38284) +++ lib/irb/magic-file.rb (revision 38285) @@ -8,9 +8,10 @@ line = io.gets line = io.gets if line[0,2] == "#!" encoding = detect_encoding(line) + internal_encoding = encoding encoding ||= default_src_encoding io.rewind - io.set_encoding(encoding, nil) + io.set_encoding(encoding, internal_encoding) if block_given? begin -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/