[python] <type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xe5 in position 9

i am developing a plugin for getting rss from a website which is utf-8, when loading the code from the site, i got these error: 

<type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xe5 in position 9

here is the code what i used before:

title = entry_rss.title.encode('UTF-8')

then i use these code to resolve this issue:

title = entry_rss.title.encode('UTF-8')
title = unicode(title, "utf-8")

 

Have fun with python! 

 

posted @ 2012-08-24 10:56  DavidHHuan  阅读(1767)  评论(0编辑  收藏  举报