文本编码格式转换工具 - iconv

本文介绍了如何使用iconv工具进行文本编码格式转换。包括基本语法、常用选项及示例,帮助用户轻松掌握不同编码间的文件转换技巧。

文本编码格式转换工具 - iconv

iconv ‐ 用于把给定文件从一种编码格式转换为另一种编码格式 ( Convert encoding of given files from one encoding to another )

语法格式:
iconv −f encoding1 −t encoding2 -o outputfile inputfile
这个命令将把给定文件 inputfile 从编码格式 encoding1 变成 encoding2 编码格式,并输出到文件 outputfile

The iconv program converts the encoding of characters in inputfile from one coded character set to another. The result is written to standard output unless otherwise specified by the −−output option.
命令可用选项如下:
−−from−code, −f encoding Convert characters from encoding
−−to−code, −t encoding Convert characters to encoding
−−list, −l List known coded character sets
−c Omit invalid characters from output
−−output, −o file Specify output file (instead ofstdout)
−−silent, −s Supress warnings
−−verbose Print progress information
−−help, −? Give help list.
−−usage Give a short usage message
−−version, −V Print program version

iconv was written by Ulrich Drepper as part of the GNU C Library.
This man page was written by Joel Klecker >espy@debian.org<, for the Debian GNU/Linux system.

比如下面的命令:
iconv -f UTF-8 -t GBK -o h.txt g.txt # 把文件 g.txt 从 UTF-8 编码格式转换为 GBK 编码格式,并保存为 h.txt
iconv -f GBK -t GB2312 -o i.txt h.txt # 把文件 h.txt 从 GBK 编码格式转换为 GB2312 编码格式,并保存为 i.txt

【作者: Liberal】【访问统计:】【2007年10月26日 星期五 19:05】【注册】【打印】

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值