diff --git a/src/calibre/__init__.py b/src/calibre/__init__.py index eb428e9de4..7df3699234 100644 --- a/src/calibre/__init__.py +++ b/src/calibre/__init__.py @@ -474,7 +474,7 @@ def strftime(fmt, t=None): def my_unichr(num): try: return unichr(num) - except ValueError: + except (ValueError, OverflowError): return u'?' def entity_to_unicode(match, exceptions=[], encoding='cp1252', diff --git a/src/calibre/ebooks/mobi/writer.py b/src/calibre/ebooks/mobi/writer.py index c1cde59718..de26b58058 100644 --- a/src/calibre/ebooks/mobi/writer.py +++ b/src/calibre/ebooks/mobi/writer.py @@ -172,6 +172,9 @@ class Serializer(object): hrefs = self.oeb.manifest.hrefs buffer.write('') for ref in self.oeb.guide.values(): + # The Kindle decides where to open a book based on the presence of + # an item in the guide that looks like + # path = urldefrag(ref.href)[0] if path not in hrefs or hrefs[path].media_type not in OEB_DOCS: continue