Difference between Mac and Linux iconv UTF16 to UTF8

时间:2017-04-09 23:20:18

标签: macos utf-8 utf-16

I'm sure this is one of those weird differences between Linux and the Mac. On Linux I can convert a UTF-16 encoded file to a UTF-8 encoded one by doing:

 iconv -f UTF-16 -t UTF-8 /tmp/geocache_visits.txt > /tmp/converted_geocache_visits.txt

However when I do it on my MacBook Pro, I end up with weird characters with some Chinese or Japanese interspersed. I've tried some other formats (like ascii and UTF-8-MAC) which iconv --list claims to be ok, but it errors out.

How can I convert it into something I can read?

1 个答案:

答案 0 :(得分:0)

使用UTF-16LE的建议就像一个魅力。谢谢!