使用iconv命令将文档的编码进行转换即可。
iconv默认情况下,是没有被安装的,下面简单介绍下iconv的安装过程:
1. 下载 :
http://www.gnu.org/software/libiconv/#TOCdownloading
2. 安装:
下载完成后,切换到下载目录先进行解压:
3. 命令学习
该工具安装完成后,肯定要先了解下这个命令的用法吧,这个没什么可说的:
我们会看到下面的内容:
说的很明白,就是按照下面的格式进行转换:
iconv -f 原编码 -t 目标编码 要转换的文件
4. 编码转换:
学会了编码的转化,我们就举了例子示范一下:
此时我们打开这个test.convert.txt文件就会发现,原来的中文显示正常了^-^
注意:
如果不出意外的话,上面的安装步骤可没有那么顺利,在make的时候,会提示下面的错误:
这个这个软件本身存在的一个Bug,通过Google,发现一个解决该问题的补丁,内容如下:
PS:内容中的"+"表示新增的内容,"-"表示删除的内容!
那我们只要进行如下操作即可解决这个问题:
1. 切换到srclib目录下:
iconv默认情况下,是没有被安装的,下面简单介绍下iconv的安装过程:
1. 下载 :
http://www.gnu.org/software/libiconv/#TOCdownloading
2. 安装:
下载完成后,切换到下载目录先进行解压:
然后进入解压后的文件中
查看其中的README文件,我们可以看到安装步骤:(当然,如果您熟悉 源码 的安装,这步完全可以省略^-^)3. 命令学习
该工具安装完成后,肯定要先了解下这个命令的用法吧,这个没什么可说的:
我们会看到下面的内容:
说的很明白,就是按照下面的格式进行转换:
iconv -f 原编码 -t 目标编码 要转换的文件
4. 编码转换:
学会了编码的转化,我们就举了例子示范一下:
此时我们打开这个test.convert.txt文件就会发现,原来的中文显示正常了^-^
注意:
如果不出意外的话,上面的安装步骤可没有那么顺利,在make的时候,会提示下面的错误:
这个这个软件本身存在的一个Bug,通过Google,发现一个解决该问题的补丁,内容如下:
PS:内容中的"+"表示新增的内容,"-"表示删除的内容!
那我们只要进行如下操作即可解决这个问题:
1. 切换到srclib目录下:
2. 修改stdio.in.h文件:
通过搜索,定位到_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");这一行,然后在这一行的前后加上条件编译即可,修改后的内容如下: 3. 保存退出,然后再进行make, make install便可顺利安装^-^