iconv 文件格式转换(gbk和utf8)

 iconv  -f UTF-8 -t GBK filename  -o xx.gbk.txt

 iconv  -f  GBK -t   UTF-8 filename  -o xx.utf8.txt

 

 

[root@redis22 ~]# cat 1
12io131
张三
[root@redis22 ~]# file 1
1: UTF-8 Unicode text
[root@redis22 ~]# iconv -f UTF-8 -t GBK 1 -o xx.gbk.txt

[root@redis22 ~]# file xx.gbk.txt
xx.gbk.txt: ISO-8859 text

把文件sz到本地用notepad++打开不会乱码

 

posted on 2020-03-04 10:39  寒星12345678999  阅读(3473)  评论(0编辑  收藏  举报