[issue39727] cgi.parse() fatally attempts str.decode when handling multipart/form-data
Robert
report at bugs.python.org
Thu Sep 3 09:42:42 EDT 2020
Robert <kxroberto at googlemail.com> added the comment:
Would this patch already solve? :
https://github.com/python/cpython/pull/19130
There seems to be another bug: The strange 'latin-1' default encoding of cgi.parse(), which only has effect in non-mulitpart:
if hasattr(fp,'encoding'):
encoding = fp.encoding
else:
encoding = 'latin-1'
( cgi.FieldStorage and the other functions in cgi and urllib.parse use a 'utf-8' default correctly - and do not try fp.encoding, which is usually not present and not reasonable in form handling WSGI. And 'application/x-www-form-urlencoded' implies utf-8. )
=> that default should possibly become utf-8. Optionally cgi.parse() could take an extra parameter encoding=None .
----------
nosy: +kxroberto2
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39727>
_______________________________________
More information about the Python-bugs-list
mailing list