This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: cgi.py proposals : sys.stdout encoding + rewriting of parsing functions
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, quentel, vstinner
Priority: normal Keywords: patch

Created on 2011-01-29 21:15 by quentel, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
cgi_20110129.diff quentel, 2011-01-29 21:15 diff for cgi.py
Messages (3)
msg127487 - (view) Author: Pierre Quentel (quentel) * Date: 2011-01-29 21:15
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
msg139647 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-07-02 13:49
See also #1610654 and #6234.
msg291116 - (view) Author: Pierre Quentel (quentel) * Date: 2017-04-04 08:49
I close this issue and will open a more specific one for the rewriting of parse_multipart()
History
Date User Action Args
2022-04-11 14:57:12adminsetgithub: 55275
2017-04-04 08:49:21quentelsetstatus: open -> closed
resolution: out of date
messages: + msg291116

stage: resolved
2011-07-04 01:19:30vstinnersetnosy: + vstinner
2011-07-02 13:49:32eric.araujosetnosy: + eric.araujo
messages: + msg139647
2011-01-29 21:15:40quentelcreate