RSS: Another attempt at fixing encoding issues (again).

This commit is contained in:
Valentin Lorentz 2014-03-22 11:56:38 +00:00
parent ecadc05c7c
commit 0c2ab9d83b

View File

@ -150,15 +150,15 @@ class RSS(callbacks.Plugin):
if headline[2]:
pubDate = ' [%s]' % (headline[2],)
if sys.version_info[0] < 3:
try:
import charade.universaldetector
u = charade.universaldetector.UniversalDetector()
u.feed(headline[0])
u.close()
encoding = u.result['encoding']
except ImportError:
encoding = 'utf8'
if isinstance(headline[0], unicode):
try:
import charade.universaldetector
u = charade.universaldetector.UniversalDetector()
u.feed(headline[0])
u.close()
encoding = u.result['encoding']
except ImportError:
encoding = 'utf8'
newheadlines.append(format('%s %u%s',
headline[0].encode(encoding,'replace'),
link,