码迷,mamicode.com
首页 > 其他好文 > 详细

iconv命令

时间:2018-07-09 12:29:39      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:错误信息   coding   文件   convert   strong   not   常用选项   语法   one   

iconv命令:

Convert encoding of given files from one encoding to another,更改文件的编码格式

语法格式:

iconv -f encoding -t encoding inputfile

常用选项:

-f encoding :把字符从encoding编码开始转换
-t encoding :把字符转换到encoding编码

-l 列出已知的编码字符集合 

-o file :指定输出文件 

-c :忽略输出的非法字符 

-s :禁止警告信息,但不是错误信息

实例:

[root@www1 ~]# iconv test.txt -f UTF-8 -t gbk
?????
?????
??????
??????
??????
??????
??????
You have mail in /var/spool/mail/root
[root@www1 ~]# iconv test.txt -c -f UTF-8 -t gbk
?????
?????
??????
??????
??????
??????
??????
[root@www1 ~]# iconv test.txt -c -f UTF-8 -t gbk -o testt.txt
You have mail in /var/spool/mail/root
[root@www1 ~]# cat testt.txt
?????
?????
??????
??????
??????
??????
??????


iconv命令

标签:错误信息   coding   文件   convert   strong   not   常用选项   语法   one   

原文地址:http://blog.51cto.com/12107790/2139092

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!