mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #874 (UnicodeDecodeError: in feeds2disk)
This commit is contained in:
parent
df883310c2
commit
5c8c683c2f
@ -491,7 +491,9 @@ class Markup(unicode):
|
|||||||
if hasattr(text, '__html__'):
|
if hasattr(text, '__html__'):
|
||||||
return Markup(text.__html__())
|
return Markup(text.__html__())
|
||||||
|
|
||||||
text = unicode(text).replace('&', '&') \
|
if isinstance(text, str):
|
||||||
|
text = text.decode('utf-8', 'replace')
|
||||||
|
text = text.replace('&', '&') \
|
||||||
.replace('<', '<') \
|
.replace('<', '<') \
|
||||||
.replace('>', '>')
|
.replace('>', '>')
|
||||||
if quotes:
|
if quotes:
|
||||||
|
@ -7,7 +7,7 @@ Defines various abstract base classes that can be subclassed to create powerful
|
|||||||
__docformat__ = "restructuredtext en"
|
__docformat__ = "restructuredtext en"
|
||||||
|
|
||||||
|
|
||||||
import logging, os, cStringIO, time, traceback, re, urlparse
|
import logging, os, cStringIO, time, traceback, re, urlparse, sys
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
@ -533,6 +533,9 @@ class BasicNewsRecipe(object, LoggingInterface):
|
|||||||
self.image_map[feed.image_url] = img
|
self.image_map[feed.image_url] = img
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
if isinstance(feed.image_url, str):
|
||||||
|
feed.image_url = feed.image_url.decode(sys.getfilesystemencoding(), 'strict')
|
||||||
|
|
||||||
|
|
||||||
templ = templates.FeedTemplate()
|
templ = templates.FeedTemplate()
|
||||||
return templ.generate(feed, self.description_limiter).render(doctype='xhtml')
|
return templ.generate(feed, self.description_limiter).render(doctype='xhtml')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user