From 8297eebb61a5b3987d4d4452dc22377b3ab89690 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 14 Sep 2012 17:56:15 +0200 Subject: [PATCH] Don't horribly die when dumping a mobi whose HTML content is not encoded in UTF-8 --- src/calibre/ebooks/mobi/debug/mobi6.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/mobi/debug/mobi6.py b/src/calibre/ebooks/mobi/debug/mobi6.py index fb5674653c..938629e391 100644 --- a/src/calibre/ebooks/mobi/debug/mobi6.py +++ b/src/calibre/ebooks/mobi/debug/mobi6.py @@ -802,7 +802,7 @@ def inspect_mobi(mobi_file, ddir): alltext += rec.raw of.seek(0) - root = html.fromstring(alltext.decode('utf-8')) + root = html.fromstring(alltext.decode(f.mobi_header.encoding)) with open(os.path.join(ddir, 'pretty.html'), 'wb') as of: of.write(html.tostring(root, pretty_print=True, encoding='utf-8', include_meta_content_type=True))