文本编码格式转换工具 - 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】【注册】【打印】
本文介绍了如何使用iconv工具进行文本编码格式转换。包括基本语法、常用选项及示例,帮助用户轻松掌握不同编码间的文件转换技巧。
2340

被折叠的 条评论
为什么被折叠?



