Fix RSS encoding problem

This commit is contained in:
Valentin Lorentz 2011-01-01 17:24:13 +01:00
parent f45e0b01ac
commit 6e6fd58ea7

View File

@ -264,8 +264,12 @@ class RSS(callbacks.Plugin):
def _getConverter(self, feed):
toText = utils.web.htmlToText
if 'encoding' in feed:
return lambda s: toText(s).strip().encode(feed['encoding'],
'replace')
def conv(s):
try:
return toText(s).strip().encode(feed['encoding'],'replace')
except UnicodeEncodeError:
return toText(s.encode('utf-8', 'ignore')).strip()
return conv
else:
return lambda s: toText(s).strip()