用法:
一般性转码:
$ iconv -f [源文件编码] -t [目标文件编码] [源文件] > [目标文件]
如果转码的时候报错,会停止,可以加上忽略标识:转码的时候报错, 比如:iconv: illeagal input sequence at xxxx
,转码会停止,可以加上忽略标识:
$ iconv -f [源文件编码]//IGNORE -t [目标文件编码]//IGNORE [源文件] > [目标文件]
示例:
$ iconv -f gb18030 -t UTF-8 /root/source.txt > /root/target.txt
$ iconv -f gb18030//IGNORE -t UTF-8//IGNORE /root/source.txt > /root/target.txt