[Web-SIG] Python 3.0 and WSGI 1.0.
Guido van Rossum
guido at python.org
Wed Apr 1 18:34:24 CEST 2009
On Wed, Apr 1, 2009 at 5:18 AM, Robert Brewer <fumanchu at aminus.org> wrote:
> Good timing. We had been thinking to make everything strings except for
> SCRIPT_NAME, PATH_INFO, and QUERY_STRING, since these few are pulled
> from the Request-URI, which may be in any encoding. It was thought that
> the app would be best-qualified to decode those three.
Argh. The *meaning* of these fields is clearly text. It would be most
unfortunately if all apps were required to deal with decoding bytes
for these (there is no choice any more, unlike in 2.x). I appreciate
the sentiment that the encoding is unknown, but I would much prefer it
if there was a default encoding that the app could override, or if
there was some other mechanism whereby the app would not have to be
bothered with decoding bytes unless it cared.
Note that Py3k also treats filenames as text, with an optional escape
hatch for using bytes that only very few apps will need to use.
> I hope to discuss that further this morning at the sprints. Turns out
> the cgi module in Python 3 only does text, not bytes. I considered
> submitting a patch to make it handle bytes for fp/environ but that
> became difficult quickly and may complicate the cgi module needlessly if
> we can instead use unicode for those 3 environ entries. I'll report back
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Web-SIG