CHM Input: Fix a regression in calibre 5.0 that broke opening of some files that dont specify a character encoding. Fixes #1922503 [E-book viewer: error opening a *.chm file](https://bugs.launchpad.net/calibre/+bug/1922503)

py3 compat
This commit is contained in:
Kovid Goyal 2021-04-05 22:09:46 +05:30
parent 30f6fc5262
commit a031f07214
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -77,6 +77,8 @@ class CHMReader(CHMFile):
ans = lcid[0] ans = lcid[0]
if ans: if ans:
try: try:
if isinstance(ans, bytes):
ans = ans.decode('ascii')
codecs.lookup(ans) codecs.lookup(ans)
except Exception: except Exception:
ans = None ans = None