linux下使用iconv命令转换gbk编码为UTF-8编码

时间:2026-02-12 20:41:21

1、1。通过iconv -l 命令查看,其支持的编码格式还不少,之间可以互相转换

linux下使用iconv命令转换gbk编码为UTF-8编码

2、2 转换gbk编码文件为utf-8编码文件

简洁命令:iconv  -f gbk -t utf-8 index.html > aautf8.html

其中-f指的是原始文件编码,-t是输出编码  index.html 是原始文件   aautf8.html是输出结果文件

linux下使用iconv命令转换gbk编码为UTF-8编码

3、3 转换gbk编码文件为utf-8编码文件

详细命令:iconv -c --verbose  -f gbk -t utf-8 index.html -o index_utf8.html

-c 指的是从输出中忽略无效的字符, --verbose指的是打印进度信息   -o是输出文件

linux下使用iconv命令转换gbk编码为UTF-8编码

4、4. 转换utf-8编码文件为gb2312编码文件

详细命令:iconv -c --verbose  -f utf-8 -t gb2312 index_utf8.html -o index_gb2312.html

linux下使用iconv命令转换gbk编码为UTF-8编码

5、5 php中iconv函数使用方法,iconv函数库能够完成各种字符集间的转换,是php编程中不可缺少的基础函数库

1.首先下载libiconv函数库

2、解压缩tar -zxvf libiconv-1.9.2.tar.gz

3、安装libiconv        configure --prefix=/usr/local/iconv        make        make install 4、重新编译php 增加编译参数--with-iconv=/usr/local/iconv 

结果:iconv被安装到/usr/local/目录中

linux下使用iconv命令转换gbk编码为UTF-8编码

© 2026 海能知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com