New submission from Sworddragon: 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) ---------- components: IO files: test.py messages: 204849 nosy: Sworddragon priority: normal severity: normal status: open title: print() and write() are relying on sys.getfilesystemencoding() instead of sys.getdefaultencoding() type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file32914/test.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19846> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com