At 08:07 AM 5/8/2009 -0700, Robert Brewer wrote:
I decided that that single type should be byte strings because I want
WSGI middleware and applications to be able to choose what encoding
their output is. Passing unicode to the server would require some
out-of-band method of telling the server which encoding to use per
response, which seemed unacceptable.

I find the above baffling, since PEP 333 explicitly states that when using unicode types, they're not actually supposed to *be* unicode -- they're just bytes decoded with latin-1.

So, the server doesn't need to know "what encoding to use" -- it's latin-1, plain and simple. (And it's an error for an application to produce a unicode string that can't be encoded as latin-1.)

To be even more specific: an application that produces strings can "choose what encoding to use" by encoding in it, then decoding those bytes via latin-1. (This is more or less what Jython and IronPython users are doing already, I believe.)

_______________________________________________
Web-SIG mailing list
Web-SIG@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: 
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com

Reply via email to