mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Bypass decoding errors during html detection
Decoding may fail on the header chunk if the file is utf-8 encoded and the chunk ends on a continuation byte.
This commit is contained in:
parent
529119caad
commit
efee7be50d
@ -115,7 +115,7 @@ class HTMLFile(object):
|
||||
encoding = detect_xml_encoding(src)[1]
|
||||
if encoding:
|
||||
try:
|
||||
header = header.decode(encoding)
|
||||
header = header.decode(encoding, errors='ignore')
|
||||
except ValueError:
|
||||
pass
|
||||
self.is_binary = level > 0 and not bool(self.HTML_PAT.search(header))
|
||||
|
Loading…
x
Reference in New Issue
Block a user