Minor update

This commit is contained in:
Miroslav Štampar 2026-06-11 18:38:54 +02:00
parent a100496ec0
commit 7747112340
3 changed files with 5 additions and 5 deletions

View file

@ -235,13 +235,13 @@ def checkCharEncoding(encoding, warn=True):
# Reference: http://docs.python.org/library/codecs.html
try:
codecs.lookup(encoding)
except:
except LookupError:
encoding = None
if encoding:
try:
six.text_type(getBytes(randomStr()), encoding)
except:
except (UnicodeDecodeError, LookupError):
if warn:
warnMsg = "invalid web page charset '%s'" % encoding
singleTimeLogMessage(warnMsg, logging.WARN, encoding)