Linux常用命令--iconv
2016-06-29 14:56
411 查看
1.功能:编码转换工具
2.安装方式:
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
./configure --prefix=/usr/local
make
make install
3.语法:
iconv [OPTION...] [-f encoding] [-t encoding] [inputfile ...]
iconv -l
4.参数:
-f encoding, --from-code=encoding 起始编码
-t encoding, --to-code=encoding 输出的编码
-c 忽略非法字符
-l 列出已知的编码集合
-o 指定输出文件
-s 禁止警告信息,但不是错误信息
5.例子
测试用的文件test.txt是GBK编码,与Linux编码不一致,查看时显示乱码。使用iconv 修改编码之后显示正常。
[mysql@mysql ~]$ echo $LANG
zh_cn.UTF-8
[mysql@mysql ~]$ more test.txt
[mysql@mysql ~]$ iconv -f GBK -t UTF-8 test.txt |more
今天是星期三。
2.安装方式:
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
./configure --prefix=/usr/local
make
make install
3.语法:
iconv [OPTION...] [-f encoding] [-t encoding] [inputfile ...]
iconv -l
4.参数:
-f encoding, --from-code=encoding 起始编码
-t encoding, --to-code=encoding 输出的编码
-c 忽略非法字符
-l 列出已知的编码集合
-o 指定输出文件
-s 禁止警告信息,但不是错误信息
5.例子
测试用的文件test.txt是GBK编码,与Linux编码不一致,查看时显示乱码。使用iconv 修改编码之后显示正常。
[mysql@mysql ~]$ echo $LANG
zh_cn.UTF-8
[mysql@mysql ~]$ more test.txt
[mysql@mysql ~]$ iconv -f GBK -t UTF-8 test.txt |more
今天是星期三。
相关文章推荐
- Linux socket 初步
- Linux Kernel 4.0 RC5 发布!
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- Linux 下无损图片压缩小工具介绍