Message154885
When running a python script from windows command line (cmd.exe) and redirecting its output, stdout.encoding is set to None and printing non-ascii chars fails. Encoding should be the same as without redirecting.
Example:
[Code unictest.py]
# -*- coding: utf-8 -*-
from sys import stdout, stderr
print >> stderr, 'stdout.encoding: ', stdout.encoding
print u'äöüß'
[/Code]
[windows command prompt]
C:\Daten>testunic.py
stdout.encoding: cp850
äöüß
C:\Daten>testunic.py > testunic.txt
stdout.encoding: None
Traceback (most recent call last):
File "C:\Daten\Cmd\testunic.py", line 5, in <module>
print u'├ñ├Â├╝├ƒ'
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordin
al not in range(128)
[/windows command prompt] |
|
Date |
User |
Action |
Args |
2012-03-04 09:42:34 | Redoute | set | recipients:
+ Redoute |
2012-03-04 09:42:34 | Redoute | set | messageid: <1330854154.2.0.961318278787.issue14192@psf.upfronthosting.co.za> |
2012-03-04 09:42:29 | Redoute | link | issue14192 messages |
2012-03-04 09:42:29 | Redoute | create | |
|