Edited at

[memo] エンコーディング変換経路 on Ruby1.9.3

More than 5 years have passed since last update.


version: ruby 1.9.3p0

SJISからUTF-16LEへの変換パス


SJIStoUTF-16LE.rb

p Encoding::Converter.new("SJIS", "UTF-16LE").convpath

#=> [[#<Encoding:Windows-31J>, #<Encoding:UTF-8>], [#<Encoding:UTF-8>, #<Encoding:UTF-16LE>]]

Shift_JISからUTF-16LEへの変換パス


Shift_JIStoUTF-16LE.rb

p Encoding::Converter.new("Shift_JIS", "UTF-16LE").convpath

#=> [[#<Encoding:Shift_JIS>, #<Encoding:UTF-8>], [#<Encoding:UTF-8>, #<Encoding:UTF-16LE>]]