New submission from Pierre Quentel <pierre.quen...@gmail.com>:

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

----------
components: Library (Lib)
files: cgi_20110129.diff
keywords: patch
messages: 127487
nosy: quentel
priority: normal
severity: normal
status: open
title: cgi.py proposals : sys.stdout encoding + rewriting of parsing functions
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file20612/cgi_20110129.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11066>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to