From 78e967edc6929ee925146ed60b5f4904a895a99e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Jan 2021 08:42:25 +0530 Subject: [PATCH] py3 compat: Fix diff on non HTML files not working --- src/calibre/gui2/tweak_book/diff/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/gui2/tweak_book/diff/main.py b/src/calibre/gui2/tweak_book/diff/main.py index 39e8ab4b59..c1bd6a6c7f 100644 --- a/src/calibre/gui2/tweak_book/diff/main.py +++ b/src/calibre/gui2/tweak_book/diff/main.py @@ -118,6 +118,8 @@ def get_decoded_raw(name): enc = 'utf-8' else: enc = force_encoding(raw, verbose=True) + if isinstance(enc, bytes): + enc = enc.decode('utf-8', 'ignore') try: raw = raw.decode(enc) except (LookupError, ValueError):