Steve Dower added the comment:
For more info here, cgi.parse has code like this:
def parse(fp, ...):
if fp is None:
fp = sys.stdin
encoding = getattr(fp, 'encoding', 'latin-1')
# later on...
return urllib.parse.parse_qs(a_str, encoding=encoding, ...)
As an easy hack, I added this after assigning encoding:
if len(' '.encode(encoding, errors='replace')) > 1:
encoding = 'latin-1'
I have no idea if this is a good idea or not. The current behaviour of mojibake
in the parsed result is certainly worse, since the choice of utf-16-le is
entirely contained within the parse() function.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue1602>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com