[Web-SIG] decoding environ

Graham Dumpleton graham.dumpleton at gmail.com
Sat Jul 17 13:29:36 CEST 2010


On Saturday, July 17, 2010, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Ian Bicking <ianb at ...> writes:
>>
>> So... there's been some discussion of WSGI on Python 3 lately.
>> I'm not feeling as pessimistic as some people, I feel like we were close
>> but just didn't *quite* get there.
>> Here's my thoughts:
>> * Everyone agrees keys in the environ should be native strings
>
> I don't know how that related to WSGI but it should be noted that Python 3.2
> comes with two synchronized views of the environment: os.environ (str -> str
> mapping) and os.environb (bytes -> bytes mapping).
>
> See http://docs.python.org/dev/library/os.html#os.environ
>
> Also, the way os.environ is decoded from bytes values involves the
> "surrogateescape" error handler, which ensures that non-decodeable bytes get
> their own unicode escape sequences, and can get re-encoded losslessly:
>
> http://www.python.org/dev/peps/pep-0383/

Only relevant to the extent it is needed for implementing a CGI/WSGI
bridge. Not relevant to WSGI itself.

Graham


More information about the Web-SIG mailing list