Message154885
| Author |
Redoute |
| Recipients |
Redoute |
| Date |
2012年03月04日.09:42:29 |
| SpamBayes Score |
3.316362e-08 |
| Marked as misclassified |
No |
| Message-id |
<1330854154.2.0.961318278787.issue14192@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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] |
|
History
|
|---|
| 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 |
|