From f839c4d9a9e9862208762fa6a70c1864149e4ed5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 31 Aug 2008 11:15:18 -0700 Subject: [PATCH] Fix #980 (error fectching a source with more than one rss feed) --- src/calibre/ebooks/lrf/html/convert_from.py | 2 +- src/calibre/web/feeds/feedparser.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/lrf/html/convert_from.py b/src/calibre/ebooks/lrf/html/convert_from.py index 29701e1042..b79dbe3bee 100644 --- a/src/calibre/ebooks/lrf/html/convert_from.py +++ b/src/calibre/ebooks/lrf/html/convert_from.py @@ -437,7 +437,7 @@ class HTMLConverter(object, LoggingInterface): for s in props.split(';'): l = s.split(':',1) if len(l)==2: - key = str(l[0].strip()).lower() + key = l[0].strip().lower() val = l[1].strip() prop [key] = val return prop diff --git a/src/calibre/web/feeds/feedparser.py b/src/calibre/web/feeds/feedparser.py index f2b0ee74e9..a80670555a 100755 --- a/src/calibre/web/feeds/feedparser.py +++ b/src/calibre/web/feeds/feedparser.py @@ -1452,7 +1452,7 @@ class _BaseHTMLProcessor(sgmllib.SGMLParser): # thanks to Kevin Marks for this breathtaking hack to deal with (valid) high-bit attribute values in UTF-8 feeds for key, value in attrs: if type(value) != type(u''): - value = unicode(value, self.encoding) + value = unicode(value, self.encoding, 'replace') uattrs.append((unicode(key, self.encoding), value)) strattrs = u''.join([u' %s="%s"' % (key, value) for key, value in uattrs]).encode(self.encoding) if tag in self.elements_no_end_tag: