You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python 3.2rc1 introduced a new version of cgi.py that handles correctly file uploads
In this version, the FieldStorage constructor receives an argument "encoding" which is the encoding used by the document holding the submitted form
On the CGI script side, there is currently no easy way to print the received form fields with another encoding than sys.stdout.encoding.
The proposed version introduces a function, set_stdout_encoding(charset), which can be used in the CGI script to set sys.stdout to an instance of a class that uses the charset encoding. This way, print() will use this encoding. "charset" must be the encoding defined in the content-type header sent by the CGI scrpt
This class (IOMix) was written by Glen Linderman and proposed in the 3.2rc1 version, but no consensus could be reached on time for the release
Another proposed change is a rewriting of the module-level functions parse() and parse_multipart() : they now use the FieldStorage methods instead
Activity
PierreQuentel commentedon Jan 29, 2011
Python 3.2rc1 introduced a new version of cgi.py that handles correctly file uploads
In this version, the FieldStorage constructor receives an argument "encoding" which is the encoding used by the document holding the submitted form
On the CGI script side, there is currently no easy way to print the received form fields with another encoding than sys.stdout.encoding.
The proposed version introduces a function, set_stdout_encoding(charset), which can be used in the CGI script to set sys.stdout to an instance of a class that uses the charset encoding. This way, print() will use this encoding. "charset" must be the encoding defined in the content-type header sent by the CGI scrpt
This class (IOMix) was written by Glen Linderman and proposed in the 3.2rc1 version, but no consensus could be reached on time for the release
Another proposed change is a rewriting of the module-level functions parse() and parse_multipart() : they now use the FieldStorage methods instead
merwok commentedon Jul 2, 2011
See also bpo-1610654 and bpo-6234.
PierreQuentel commentedon Apr 4, 2017
I close this issue and will open a more specific one for the rewriting of parse_multipart()