[issue3348] Cannot start wsgiref simple server in Py3k

Matt Giuca report at bugs.python.org
Tue Jul 22 18:12:20 CEST 2008


Matt Giuca <matt.giuca at gmail.com> added the comment:

Wow, I read the WSGI spec. That seems very strange that it says "HTTP
does not directly support Unicode, and neither does this interface."
Clearly HTTP *does* support Unicode, because it allows you to specify an
encoding.

I assume then that the ISO-8859-1 characters the WSGI functions receive
will be treated as byte values. (That's rather silly; it's just dodging
the issue of Unicode rather than supporting it).

But in any event, the PEP has spoken, so we stick with Latin-1.

With respect to the text/binary stream, I think it would be best if it's
a binary stream, and we explicitly convert those str objects (which WSGI
says must only contain Latin-1 range characters) into bytes objects
(simply treating code points as bytes; in other words calling
.encode('latin-1')) and writing them to the binary stream. (Since the
WSGI spec is so adamant we deal in bytes).

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3348>
_______________________________________


More information about the Python-bugs-list mailing list