使用iconv 转换编码

在linux下经常遇到编码问题,有时可以统一使用iconv把编码转换一下,使用方法如下:

Usage: iconv [OPTION…] [FILE…]
Convert encoding of given files from one encoding to another.

Input/Output format specification:
-f, –from-code=NAME       encoding of original text
-t, –to-code=NAME         encoding for output

Information:
-l, –list                 list all known coded character sets

Output control:
-c                         omit invalid characters from output
-o, –output=FILE          output file
-s, –silent               suppress warnings
–verbose              print progress information

-?, –help                 Give this help list
–usage                Give a short usage message
-V, –version              Print program version

e.g:

iconv -f gbk -t utf8 -o a.txt xx.txt

此条目发表在linux shell分类目录。将固定链接加入收藏夹。

发表评论