Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8aada25

Browse files
committed
Fixes #1471
1 parent 3dc8820 commit 8aada25

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/request/basic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from lib.core.settings import MAX_CONNECTION_TOTAL_SIZE
3434
from lib.core.settings import META_CHARSET_REGEX
3535
from lib.core.settings import PARSE_HEADERS_LIMIT
36+
from lib.core.settings import UNICODE_ENCODING
3637
from lib.core.settings import VIEWSTATE_REGEX
3738
from lib.parse.headers import headersParser
3839
from lib.parse.html import htmlParser
@@ -197,7 +198,7 @@ def checkCharEncoding(encoding, warn=True):
197198
# Reference: http://www.iana.org/assignments/character-sets
198199
# Reference: http://docs.python.org/library/codecs.html
199200
try:
200-
codecs.lookup(encoding)
201+
codecs.lookup(encoding.encode(UNICODE_ENCODING) if isinstance(encoding, unicode) else encoding)
201202
except LookupError:
202203
if warn:
203204
warnMsg = "unknown web page charset '%s'. " % encoding

0 commit comments

Comments
 (0)