Home | Syndication | Delicious | Douban | Twitter | FriendFeed

Convert the code set of the text file

在使用Eclipse开发过程中,推荐在初始安装完成之后立刻通过“首选项”-“工作台”-“编辑器”,将文本文件的内部编码修改为UTF-8,这样有利于开发工作的国际合作。

转化文本文件内码的方法:

1,Linux提供了一个专门的指令iconv来实现转化。
大致的语法是:iconv -f coding -t coding inputfile -o outputfile
比如,我要将一个内码为GB18030的文本文件转化成内码为UTF-8,可以:
$ iconv -f GB18030 -t UTF-8 MyTestIn.txt -o MyTestOut.txt

iconv简单易用,可若在一个复杂的目录结构中进行转换,毕竟麻烦了些,所以一般需要使用shell, perl来编制一段简单的程序以实现复杂的转换工作。

2,使用专门的转换工具。
正是因为iconv的不能直接对复杂的目录层次直接操作这个问题,我们才考虑使用第三方的工具来转换。在我试用的工具中,Uni2Me短小精悍,而且是绿色软件,值得推荐一下。
下载地址:http://alf-li.pcdiscuss.com

This entry was posted on Thursday, January 27th, 2005 at 13:55 and is filed under TechNotes. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply