py3: encode string before writing ebook mimetypes to the container

Fixes saving books in the editor.
This commit is contained in:
Eli Schwartz 2019-04-11 01:46:28 -04:00
parent 11537ddd46
commit df072f7cae
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6

View File

@ -1360,7 +1360,7 @@ class EpubContainer(Container):
else: else:
from calibre.ebooks.tweak import zip_rebuilder from calibre.ebooks.tweak import zip_rebuilder
with lopen(join(self.root, 'mimetype'), 'wb') as f: with lopen(join(self.root, 'mimetype'), 'wb') as f:
f.write(guess_type('a.epub')) f.write(guess_type('a.epub').encode('utf-8'))
zip_rebuilder(self.root, outpath) zip_rebuilder(self.root, outpath)
for name, data in iteritems(restore_fonts): for name, data in iteritems(restore_fonts):
with self.open(name, 'wb') as f: with self.open(name, 'wb') as f: