HTMLZ Output: Fix HTML files being created with system encoding instead of UTF-8. Fixes #1499514 [Latin encode error while converting from epub to htmlz](https://bugs.launchpad.net/calibre/+bug/1499514)

This commit is contained in:
Kovid Goyal 2015-09-25 07:39:31 +05:30
parent fb7357f59f
commit eeccbf395c

View File

@ -70,6 +70,8 @@ class HTMLZOutput(OutputFormatPlugin):
from calibre.utils.filenames import shorten_components_to from calibre.utils.filenames import shorten_components_to
fname = shorten_components_to(100, (ascii_filename(unicode(oeb_book.metadata.title[0])),))[0] fname = shorten_components_to(100, (ascii_filename(unicode(oeb_book.metadata.title[0])),))[0]
with open(os.path.join(tdir, fname+u'.html'), 'wb') as tf: with open(os.path.join(tdir, fname+u'.html'), 'wb') as tf:
if isinstance(html, unicode):
html = html.encode('utf-8')
tf.write(html) tf.write(html)
# CSS # CSS