mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Don't horribly die when dumping a mobi whose HTML content is not encoded in UTF-8
This commit is contained in:
parent
6c42c0ea6c
commit
8297eebb61
@ -802,7 +802,7 @@ def inspect_mobi(mobi_file, ddir):
|
|||||||
alltext += rec.raw
|
alltext += rec.raw
|
||||||
of.seek(0)
|
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:
|
with open(os.path.join(ddir, 'pretty.html'), 'wb') as of:
|
||||||
of.write(html.tostring(root, pretty_print=True, encoding='utf-8',
|
of.write(html.tostring(root, pretty_print=True, encoding='utf-8',
|
||||||
include_meta_content_type=True))
|
include_meta_content_type=True))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user