New submission from Olivier Delhomme <olivier.delho...@cea.fr>: $ python3 --version Python 3.6.4
Setting LANG to en_US.UTF8 works like a charm $ export LANG=en_US.UTF8 $ python3 Python 3.6.4 (default, Jan 11 2018, 16:45:55) [GCC 4.8.5] on linux Type "help", "copyright", "credits" or "license" for more information. >>> machaine='ééééhelp me if you can' >>> >>> >>> print('{}'.format(machaine)) >>> >>> ééééhelp me if you can Unsetting LANG shell variable fails the program: $ unset LANG $ python3 Python 3.6.4 (default, Jan 11 2018, 16:45:55) [GCC 4.8.5] on linux Type "help", "copyright", "credits" or "license" for more information. >>> machaine='ééééhelp me if you can' File "<stdin>", line 0 ^ SyntaxError: 'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128) Setting LANG inside the program does not change this behavior: $ unset LANG $ python3 Python 3.6.4 (default, Jan 11 2018, 16:45:55) [GCC 4.8.5] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.environ['LANG'] = 'en_US.UTF8' >>> machaine='ééééhelp me if you can' File "<stdin>", line 0 ^ SyntaxError: 'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128) Is this an expected behavior ? How can I force an utf8 codec ? ---------- components: Interpreter Core messages: 402046 nosy: od-cea priority: normal severity: normal status: open title: ascii codec is used by default when LANG is not set type: behavior versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45232> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com