Issue #7201 has been updated by naruse (Yui NARUSE).

Status changed from Assigned to Rejected

This is not a bug in 1.9.3 and 2.0.0 while I feel this behavior is not so good.
I won't change this but it will be big change, therefore I keep compatibility in near future.
----------------------------------------
Bug #7201: Setting default_external affects STDIN encoding but default_internal does not
https://bugs.ruby-lang.org/issues/7201#change-32684

Author: brixen (Brian Ford)
Status: Rejected
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: 
Target version: 2.0.0
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-darwin10.8.0]


Changing Encoding.default_external changes STDIN.external_encoding, but changing Encoding.default_internal does not change STDIN.internal_encoding.

STDOUT and STDERR internal/external encodings are not changed in either case and are always nil.

Is this a bug? See the following IRB transcript:

$ irb
1.9.3p286 :001 > Encoding.default_external
 => #<Encoding:UTF-8> 
1.9.3p286 :002 > Encoding.default_internal
 => nil 
1.9.3p286 :003 > STDIN.external_encoding
 => #<Encoding:UTF-8> 
1.9.3p286 :004 > STDIN.internal_encoding
 => nil 
1.9.3p286 :005 > Encoding.default_external = "euc-jp"
 => "euc-jp" 
1.9.3p286 :006 > STDIN.external_encoding
 => #<Encoding:EUC-JP> 
1.9.3p286 :007 > STDIN.internal_encoding
 => nil 
1.9.3p286 :008 > Encoding.default_internal = "iso-8859-1"
 => "iso-8859-1" 
1.9.3p286 :009 > STDIN.internal_encoding
 => nil 

Thanks,
Brian





-- 
http://bugs.ruby-lang.org/