一个把Rss Feed的编码方式由GB2312转成UTF-8的CGI脚本

今天设置自己的Planet站点,用CU的feed做试验,发现会乱码,原因是CU的feed是GB2312编码的。

google到一些资料,但好像并不能完全解决问题:

小林的blog,按照这个方法做没成功。

Web4C,我写完脚本才注意到这个搜索结果,但没找到planet源码里的planetlib.py文件。

我想到的土方法,写一个cgi脚本做proxy,取回feed后做转换编码方式再输出。

转码是这样完成的: str.decode('GBK').encode('UTF-8')

下载

One thought on “一个把Rss Feed的编码方式由GB2312转成UTF-8的CGI脚本

  1. 我的网站上面feed全是乱码, 主要因为我的模版是gb2312的,但是feed是:ISO-8859-1,有什么办法解决?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.
For more help see http://daringfireball.net/projects/markdown/syntax

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>