[Web-SIG] Python 3.0 and WSGI 1.0.

James Y Knight foom at fuhm.net
Fri May 8 20:39:53 CEST 2009


On May 8, 2009, at 1:37 PM, Robert Brewer wrote:
> If Python3 WSGI apps emit unicode strings (py3k type 'str'), you're
> effectively saying the server will always call
> "chunk.encode('latin-1')". That negates any benefit of using unicode  
> as
> the type for the response. That's not "supporting unicode"; that's  
> using
> unicode exactly as if it were an opaque byte string. That's seems  
> silly
> to me when there is a perfectly useful byte string type.

Agreed. Accepting py3k "str" and always encoding in latin-1 is  
basically just undoing the separation of unicode&byte-strings that was  
one of Py3k's major design goals.

Probably there should be nothing in WSGI should be allowed to be given  
as either bytestring or character string. The spec should choose one  
or the other for each circumstance. And for body content it's clear  
that the only sane thing is a bytestring.


More information about the Web-SIG mailing list