[issue10479] cgitb.py should assume a binary stream for output

Glenn Linderman report at bugs.python.org
Mon Jan 31 05:43:33 CET 2011


Glenn Linderman <v+python at g.nevcal.com> added the comment:

So since cgi.py was fixed to use the .buffer attribute of sys.stdout, that leaves sys.stdout itself as a character stream, and cgitb.py can successfully write to that.

If cgitb.py never writes anything but ASCII, then maybe that should be documented, and this issue closed.

If cgitb.py writes non-ASCII, then it should use an appropriate encoding for the web application, which isn't necessarily the default encoding on the system.  Some user control over the appropriate encoding should be given, or it should be documented that the encoding of sys.stdout should be changed to an appropriate encoding, because that is where cgitb.py will write its character stream.  Guidance on how to do that would be appropriate for the documentation also, as a CGI application may be the first one a programmer might write that can't just use the default encoding configured for the system.

----------

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


More information about the Python-bugs-list mailing list