From eeccbf395ce50bcc2e59cb15d0f5c8d0d663c74d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 25 Sep 2015 07:39:31 +0530 Subject: [PATCH] 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) --- src/calibre/ebooks/conversion/plugins/htmlz_output.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/ebooks/conversion/plugins/htmlz_output.py b/src/calibre/ebooks/conversion/plugins/htmlz_output.py index 8a28694672..9b4f378632 100644 --- a/src/calibre/ebooks/conversion/plugins/htmlz_output.py +++ b/src/calibre/ebooks/conversion/plugins/htmlz_output.py @@ -70,6 +70,8 @@ class HTMLZOutput(OutputFormatPlugin): from calibre.utils.filenames import shorten_components_to 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: + if isinstance(html, unicode): + html = html.encode('utf-8') tf.write(html) # CSS