[Web-SIG] WSGI, Python 3 and Unicode

Guido van Rossum guido at python.org
Sun Dec 9 03:48:56 CET 2007

On Dec 8, 2007 12:37 AM, Graham Dumpleton <graham.dumpleton at gmail.com> wrote:
> On 08/12/2007, Phillip J. Eby <pje at telecommunity.com> wrote:
> > * When running under Python 3, servers MUST provide a text stream for
> > wsgi.errors
> In Python 3, what happens if user code attempts to output to a text
> stream a byte string? Ie., what would be displayed?

Nothing. You get a TypeError.

> Also, if wsgi.errors is a text stream, presume that if a WSGI adapter
> has to internally map this to a C char* like API for logging that it
> would need to apply standard Python encoding to yield usable char*
> string for output.

The encoding can/must be specified per text stream.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Web-SIG mailing list