[Python-Dev] PEP 3333: wsgi_string() function

James Y Knight foom at fuhm.net
Fri Jan 7 15:43:25 CET 2011


On Jan 7, 2011, at 6:51 AM, Victor Stinner wrote:
> I don't understand why you are attached to this horrible hack
> (bytes-in-unicode). It introduces more work and more confusing than
> using raw bytes unchanged.
> 
> It doesn't work and so something has to be changed.

It's gross but it does work. This has been discussed ad-nausium on web-sig over a period of years.

I'd like to reiterate that it is only even a potential issue for the PATH_INFO/SCRIPT_NAME keys. Those two keys are required to have been urldecoded already, into byte-data in some encoding. For all the other keys (including the ones from os.environ), they are either *properly* decoded in 8859-1 or are just ascii (possibly still urlencoded, so the app needs to urldecode and decode into a string with the correct encoding).

James


More information about the Python-Dev mailing list