Ruby 对字符串进行转码

require 'iconv'
input_encoding = "windows-1252"
output_encoding = 'utf-8'

converted_doc = Iconv.new(output_encoding, input_encoding).iconv("asdf")

编程技巧