mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
plugins/RSS: If the feed supplies an encoding, encode the headlines with it.
This commit is contained in:
parent
a88f52bc7f
commit
14dc0c0201
@ -256,9 +256,13 @@ class RSS(callbacks.Plugin):
|
||||
|
||||
def getHeadlines(self, feed):
|
||||
headlines = []
|
||||
if 'encoding' in feed:
|
||||
conv = lambda s: s.encode(feed['encoding'], 'replace')
|
||||
else:
|
||||
conv = lambda s: s
|
||||
for d in feed['items']:
|
||||
if 'title' in d:
|
||||
title = utils.web.htmlToText(d['title']).strip()
|
||||
title = conv(utils.web.htmlToText(d['title']).strip())
|
||||
link = d.get('link')
|
||||
if link:
|
||||
headlines.append((title, link))
|
||||
|
@ -75,6 +75,10 @@ class RSSTestCase(ChannelPluginTestCase):
|
||||
self.assertError('advogato')
|
||||
self.assertError('rss advogato')
|
||||
|
||||
def testNonAsciiFeeds(self):
|
||||
self.assertNotError('rss http://www.heise.de/newsticker/heise.rdf')
|
||||
self.assertNotError('rss http://www.golem.de/rss.php?feed=ATOM0.3')
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user