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: