mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-05 07:20:58 +00:00
Check that charset is not None before lowering it in set_encoding().
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3547 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
61083d6a36
commit
9de237b4c2
1 changed files with 2 additions and 1 deletions
|
|
@ -208,6 +208,7 @@ def resolve_entities (s):
|
|||
"""
|
||||
return _entity_re.sub(_resolve_entity, s)
|
||||
|
||||
SUPPORTED_CHARSETS = ["utf-8", "iso-8859-1", "iso-8859-15"]
|
||||
|
||||
_encoding_ro = re.compile(r"charset=(?P<encoding>[-0-9a-zA-Z]+)")
|
||||
|
||||
|
|
@ -223,7 +224,7 @@ def set_encoding (parsobj, attrs):
|
|||
if attrs.get_true('http-equiv', u'').lower() == u"content-type":
|
||||
charset = attrs.get_true('content', u'')
|
||||
charset = get_ctype_charset(charset.encode('ascii', 'ignore'))
|
||||
if charset is not None:
|
||||
if charset and charset.lower() in SUPPORTED_CHARSETS:
|
||||
parsobj.encoding = charset
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue