From: "Martin J. Dürst" Date: 2012-11-11T00:20:33+09:00 Subject: [ruby-core:49199] Re: [ruby-trunk - Bug #7201] Setting default_external affects STDIN encoding but default_internal does not Hello Brian, I'm not sure what the reason was for the current state, but I can easily imagine a situation where stdin/stdout are the console and therefore in one encoding, whereas the data a script is working on is all in another encoding. Regards, Martin. On 2012/11/10 7:58, brixen (Brian Ford) wrote: > > Issue #7201 has been updated by brixen (Brian Ford). > > > Can someone please explain how the inconsistency with how the rest of IO instances would behave with transcoding is not a bug? > > Thanks, > Brian > ---------------------------------------- > Bug #7201: Setting default_external affects STDIN encoding but default_internal does not > https://bugs.ruby-lang.org/issues/7201#change-32727 > > 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 > => # > 1.9.3p286 :002> Encoding.default_internal > => nil > 1.9.3p286 :003> STDIN.external_encoding > => # > 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 > => # > 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 > > > > >