1:查看文件字符集
file -i test.txt
[root@localhost zzj_temp]# file -i test.txt
test.txt: text/plain; charset=utf-8
2:iconv –l 查看当前支持的字符集
3:文本字符集转换
iconv test.txt -f utf-8 -t UNICODE -o test1.txt – verbose
[root@localhost zzj_temp]# file -i test1.txt
test1.txt: application/octet-stream; charset=binary
iconv参数的解释:
-f encoding 表示原始文件的字符编码。
-t encoding 表示输出文件的字符编码。
-l 表示列举所有已知的字符集。
-c 表示从输出中忽略无效的字符
-o filename 表示输出文件
-s 表示关闭警告。
--verbose 表示显示进度信息