[issue4947] sys.stdout fails to use default encoding as advertised

Jan Kaliszewski report at bugs.python.org
Tue May 12 16:56:03 CEST 2009


Jan Kaliszewski <zuo at chopin.edu.pl> added the comment:

PS. The main problem is not a lack of feature but that inconsistency, 
and that's not documented if File type docs:

print >>my_file, my_unicode  # <- is encoded with my_file.encoding
my_file.write(my_unicode)  # <- is encoded with my_file.encoding

# and on the other hand:
print my_unicode -- works  # <- is encoded with my_file.encoding
sys.stdout.write(my_unicode)  # <- is encoded with what is returned by 
sys.getdefaultencoding()

----------
versions: +Python 2.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4947>
_______________________________________


More information about the Python-bugs-list mailing list