[Web-SIG] WSGI, Python 3 and Unicode

James Y Knight foom at fuhm.net
Fri Dec 7 01:23:40 CET 2007


On Dec 6, 2007, at 7:15 PM, Phillip J. Eby wrote:
> WSGI already copes, actually.  Note that Jython and IronPython have
> this issue today, and see:
>
> http://www.python.org/dev/peps/pep-0333/#unicode-issues
>
> """On Python platforms where the str or StringType type is in fact
> Unicode-based (e.g. Jython, IronPython, Python 3000, etc.), all
> "strings" referred to in this specification must contain only code
> points representable in ISO-8859-1 encoding (\u0000 through \u00FF,
> inclusive). It is a fatal error for an application to supply strings
> containing any other Unicode character or code point. Similarly,
> servers and gateways must not supply strings to an application
> containing any other Unicode characters."""

It would seem very odd, however, for WSGI/python3 to use strings- 
restricted-to-0xFF for network I/O while everywhere else in python3 is  
going to use bytes for the same purpose. You'd have to modify your app  
to call write(unicodetext.encode('utf-8').decode('latin-1')) or so....

James


More information about the Web-SIG mailing list