« Return to Thread: [ruby-dev:38278] [BUG:1.9] io does not convert str when ext == intern

[ruby-dev:38278] [BUG:1.9] io does not convert str when ext == intern

by sheepman-2 :: Rate this Message:

Reply to Author | View in Thread

こんばんは sheepman です。

IO の外部エンコーディングと内部エンコーディングが等しい場合に、
変換が必要な場合でも、変換が起きません。

$ cat t.rb
# encoding:euc-jp
io = File.open('t.txt', 'w+', { :internal_encoding => "SJIS" } )
io.write("ほげ")

$ ruby-1.9 -v -Esjis t.rb
ruby 1.9.2dev (2009-04-04 trunk 23134) [i686-linux]

$ nkf --guess t.txt
EUC-JP


 « Return to Thread: [ruby-dev:38278] [BUG:1.9] io does not convert str when ext == intern