最好的办法是使用 iconv 命令转换一下文本文件的编码格式。

命令参考:

iconv -f encoding -t encoding sourcefile > destinationfile

应用案例(将 GB18030 编码的 old.txt 文件转为 UTF8 编码的 new.txt):

iconv -f GB18030 -t utf-8 /path/to/old.txt > /path/to/new.txt

标签: macos, iconv