[Web-SIG] Request for Comments on upcoming WSGI Changes
P.J. Eby
pje at telecommunity.com
Tue Sep 22 16:06:25 CEST 2009
At 11:28 AM 9/22/2009 +0200, Armin Ronacher wrote:
>Hi,
>
>Alan Kennedy schrieb:
> > 2. Give the programmer (possibly mojibake) unicode strings in the WSGI
> > environ anyway
> > 3. And let them solve their problems themselves, using server
> > configuration or bespoke middleware
>Because that problem was solved a long ago in applications themselves.
>Webob, Werkzeug, Paste, Pylons, Django, you name it, all are operating
>on unicode. And the way they do that is straightforward.
>
>Now currently what we have to do on Python 3 is to encode the data again
>and decode it with the target charset. Unnecessary roundtrips that just
>slow the whole thing down. What for?
What roundtrips? If they're operating on unicode, either they're in
violation of the spec (in which case, f*** them), or they're already
running a decode every time they pull something out of the
environ... and using latin-1 or surrogates is only one encoding call
different from what they're doing now.
So if anybody really cares about that one extra encode(), write a C
function to do the transcode in a single step and add it to the
stdlib for 2.x and 3, as well as publishing a standalone
version. Voila. We're done and outta here.
More information about the Web-SIG
mailing list