0
我在我的數據中遇到了Ruby 1.9 CSV和無效的UTF-8字符問題。Ruby CSV UTF-8編碼/轉換問題
我的代碼看起來是這樣的:
CSV.foreach("small-test2.csv", options) do |row |
name, workgroup, address, actual, output = row
next if nbname == "NBName"
@ssl_info[name] = workgroup, address, actual, output
ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
clean = ic.iconv(output + ' ')[0..-2]
puts clean
end
但是我仍然得到以下幾點:
ArgumentError: invalid byte sequence in UTF-8
=~ at org/jruby/RubyRegexp.java:1487
=~ at org/jruby/RubyString.java:1686
有什麼我錯過這裏?
你不應該用iconv 1.9 – pguardiario