From a837768348809ff83a2f1f495548b6a0fc279000 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 22 Jul 2015 14:09:26 +0530 Subject: [PATCH] Dont fail to recognize a UTF-8 encoded file even when the coding regexp has a spurious match --- src/calibre/gui2/tweak_book/diff/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/diff/main.py b/src/calibre/gui2/tweak_book/diff/main.py index 9db5ac7ba2..7280b7fd7b 100644 --- a/src/calibre/gui2/tweak_book/diff/main.py +++ b/src/calibre/gui2/tweak_book/diff/main.py @@ -118,7 +118,10 @@ def get_decoded_raw(name): try: raw = raw.decode(enc) except (LookupError, ValueError): - pass + try: + raw = raw.decode('utf-8') + except ValueError: + pass return raw, syntax