Category: Miscellaneous Keywords: gb2312.enc
我用XML::RSS创建rss文件是没问题,更新的时候却总是乱码。原因可能是创建rss时我是提取mysql数据库里的资料(utf8编码的), 而更新的时候是直接使用表单里的数据,不是utf8编码的。
我试了use Encode qw/encode decode/;可没结果,将表单数据转换后,在网页编码为utf8时正确显示,写入的时候却成了乱码。
实在想不到啥好办法,只好想指定XML::RSS的encoding为gb2312试试,读取时却发现少了gb2312.enc Google了一下,下过来的都不是encmap文件,虽然名字也是gb2312.enc, 而很多Blog所提起的http://atzone.fatb.org却失效了。
下不到然后去求助朋友,在perl交流QQ群中发了个消息,没反应。找bloves要,他说Rob有,可他不在线。晕。
看看Google搜索来的东西,里面有个post在ASPN提起如何制作gb2312.enc, http://aspn.activestate.com/ASPN/Mail/Message/perl-xml/1341040
1. Download GB2312.TXT from ftp.unicode.org 2. Download the XML::Encoding 1.01 and get two binaries: make_encmap and compile_encoding 3. run make_encmap as follows: make_encmap GB2312 GB2312.TXT > GB2312.encmap 4. Add expat='yes' to the first line of GB2312.encmap 5. run compile_encoding: compile_encoding -o GB2312.enc GB2312.encmap 6. copy GB2312.enc to /usr/lib/perl5/site_perl/5.005/i386-linux/XML/Parser/Encodingscpan XML::Encoding后,却在unicode.org上找不到GB2312.txt, 有这连接,又是失效了。Google "GB2312.txt"找到的都是错的。我faint!
后来换Baidu搜索了好一阵子才在 http://eaa13.dns0755.net/~atzone/source/gb2312.enc 找到。
在自己站点做一个备份吧。给需要的人。按此下载。
Have fun! 记于 2005/01/15