Unicode stdin/stdout

Robin Becker robin at reportlab.com
Mon Nov 18 07:33:49 EST 2013


On 18/11/2013 11:47, Robin Becker wrote:
...........
> #c:\python33\lib\site-packages\sitecustomize.py
> import sys, codecs
> sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
> sys.stderr = codecs.getwriter("utf-8")(sys.stderr.detach())
........
it seems that the above needs extra stuff to make some distutils logging work 
etc etc; so now I'm using sitecustomize.py containing

import sys, codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
sys.stdout.encoding = 'utf8'
sys.stderr = codecs.getwriter("utf-8")(sys.stderr.detach())
sys.stderr.encoding = 'utf8'

-- 
Robin Becker




More information about the Python-list mailing list