This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Sworddragon
Recipients Sworddragon
Date 2013-11-30.21:40:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1385847645.21.0.327287028528.issue19846@psf.upfronthosting.co.za>
In-reply-to
Content
It seems that print() and write() (and maybe other of such I/O functions) are relying on sys.getfilesystemencoding(). But these functions are not operating with filenames but with their content. In the attachments is an example script which demonstrates this problem. Here is what I get:

sworddragon@ubuntu:~/tmp$ echo $LANG
de_DE.UTF-8
sworddragon@ubuntu:~/tmp$ python3 test.py
sys.getdefaultencoding(): utf-8
sys.getfilesystemencoding(): utf-8
ä
sworddragon@ubuntu:~/tmp$ LANG=C
sworddragon@ubuntu:~/tmp$ python3 test.py
sys.getdefaultencoding(): utf-8
sys.getfilesystemencoding(): ascii
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    print('\xe4')
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 0: ordinal not in range(128)
History
Date User Action Args
2013-11-30 21:40:45Sworddragonsetrecipients: + Sworddragon
2013-11-30 21:40:45Sworddragonsetmessageid: <1385847645.21.0.327287028528.issue19846@psf.upfronthosting.co.za>
2013-11-30 21:40:45Sworddragonlinkissue19846 messages
2013-11-30 21:40:44Sworddragoncreate