Message6667
Failed to set UTF-8 encoding for output redirected to file.
--------x.py--------
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
print sys.stdout.encoding
print sys.getdefaultencoding()
print(u"Ф")
--------x.py--------
=== Output to console works fine ===
$ java -jar jython.jar -Dpython.console.encoding=UTF-8 x.py
UTF-8
ascii
Ф
=== Output to file does not work ===
$ java -jar jython.jar -Dpython.console.encoding=UTF-8 x.py > tmp.txt 2>tmp2.txt ; cat tmp.txt
$ cat tmp.txt
None
ascii
$ cat tmp2.txt
Traceback (most recent call last):
File "x.py", line 9, in <module>
print(u"Ф")
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0424' in position 0: ordinal not in range(128) |
|
Date |
User |
Action |
Args |
2011-10-11 06:42:29 | ssoldatenko | set | recipients:
+ ssoldatenko |
2011-10-11 06:42:29 | ssoldatenko | set | messageid: <1318315349.14.0.275978336981.issue1807@psf.upfronthosting.co.za> |
2011-10-11 06:42:29 | ssoldatenko | link | issue1807 messages |
2011-10-11 06:42:28 | ssoldatenko | create | |
|