From 320c525cfebcf60c36224e00d3615b669353fb9e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 21 Mar 2021 20:00:00 +0530 Subject: [PATCH] Fix a regression in calibre 5 that broke --explode-book and --implode-book in calibre-debug.exe --- src/calibre/ebooks/tweak.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/tweak.py b/src/calibre/ebooks/tweak.py index dbb2974f61..2016359b64 100644 --- a/src/calibre/ebooks/tweak.py +++ b/src/calibre/ebooks/tweak.py @@ -126,7 +126,7 @@ def explode(ebook_file, output_dir): return h = '_' if iswindows else '.' with lopen(os.path.join(output_dir, h + '__explode_fmt__'), 'wb') as f: - f.write(fmt) + f.write(fmt.encode('utf-8')) prints('Book extracted to', output_dir) prints('Make your changes and once you are done, use --implode-book to rebuild') @@ -141,7 +141,7 @@ def implode(output_dir, ebook_file): efmt_path = os.path.join(output_dir, h + '__explode_fmt__') try: with lopen(efmt_path, 'rb') as f: - efmt = f.read() + efmt = f.read().decode('utf-8') except Exception: raise SystemExit('The folder %s does not seem to have been created by --explode-book' % output_dir) if efmt != fmt: