Don't horribly die when dumping a mobi whose HTML content is not encoded in UTF-8

This commit is contained in:
NiLuJe 2012-09-14 17:56:15 +02:00
parent 6c42c0ea6c
commit 8297eebb61

View File

@ -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))