新手问题 ruby 编码转换问题?

small_fish__ · November 12, 2012 · Last by mfb777 replied at November 12, 2012 · 2500 hits

在 Ruby 版本 1.8.7 中想对一个未知编码转化为一个特定的编码有什么好的方法呢? 用 NKF 貌似不可以的。。 在此请教下。

如果源编码未知的话,直接转换编码可能会出现乱码,最好还是能统一输入的编码,然后用 Iconv.conv 转换。或者用识别编码的库,我没这么干过。

You need to Sign in before reply, if you don't have an account, please Sign up first.