On 02:51 pm, rk...@pobox.com wrote:
I would like to tell the system that it's OK to write Unicode to
sys.out
and sys.err. However, I'm doing this in a CGI script where I don't
have
access to the system directories, and as such can't use
sys.setdefaultencoding in sitecustomize.py.
Is there a way to make this happen?
Sure, just replace the two files with versions that know how to encode
the unicode using the correct encoding:
import sys, codecs
info = codecs.lookup('utf-8') # for example
sys.stdout = info.streamwriter(sys.stdout)
sys.stderr = info.streamwriter(sys.stderr)
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list