From b70a8d5aa98a0337b2e19fadfc28385518544613 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Jul 2011 15:50:26 -0600 Subject: [PATCH] ... --- src/calibre/__init__.py | 2 +- src/calibre/ebooks/mobi/writer.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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