py3 compat: Fix diff on non HTML files not working

This commit is contained in:
Kovid Goyal 2021-01-05 08:42:25 +05:30
parent a6840fb462
commit 78e967edc6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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):