[Web-SIG] WSGI 2
pje at telecommunity.com
Tue Aug 4 18:05:13 CEST 2009
At 10:44 PM 8/4/2009 +1000, Graham Dumpleton wrote:
>In summary, what are the practical uses cases that would make passing
>bytes over UTF-8 or even latin-1 worthwhile?
My concern at this point is a nagging feeling that we are abandoning
WSGI<->HTTP equivalence for convenience in the face of changes in
Python's defaults. Had Python 3 been the standard version in
existence when WSGI 1 was created, I would've argued for making
*everything* bytes, in order to:
1. Force all encodings to be explicit, and
2. Ensure WSGI<->HTTP equivalence (i.e., WSGI==HTTP encoded in Python objects)
And this is why the original spec said that Unicode strings should be
treated as bytes -- because byte strings were always the original
target of the spec.
Please remember that WSGI is not primarily intended to provide
application developers with a convenient API; its first and most
important job is to ship the data around without mangling it in the process.
HTTP moves bytes, therefore WSGI should move bytes. For practical
reasons, it would be good to *also* support strings on the
application side, especially for application migration. However, I
see no reason to make *servers* provide decoded strings instead of bytes.
So I would ask, what is the practical use case for having the server
decode bytes into strings, instead of leaving them as bytes?
More information about the Web-SIG