From 6e6fd58ea7061b327e8145f1fa4d43fe3c221a3b Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 1 Jan 2011 17:24:13 +0100 Subject: [PATCH] Fix RSS encoding problem --- plugins/RSS/plugin.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/RSS/plugin.py b/plugins/RSS/plugin.py index fbf442e37..eb0c7af11 100644 --- a/plugins/RSS/plugin.py +++ b/plugins/RSS/plugin.py @@ -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()