[issue45232] ascii codec is used by default when LANG is not set

Marc-Andre Lemburg report at bugs.python.org
Fri Sep 17 09:19:59 EDT 2021


Marc-Andre Lemburg <mal at egenix.com> added the comment:

Yes, this is intended. ASCII is used as fallback in case Python
cannot determine the I/O encoding to use during startup. This is
also the reason why later changes to the environment have no
affect on this - the determination of the encoding has already
been applied.

You can force UTF-8 by enabling the UTF-8 mode:

export PYTHONUTF8=1

This will then have Python use UTF-8 regardless of the LANG
env var setting.

----------
nosy: +lemburg

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45232>
_______________________________________


More information about the Python-bugs-list mailing list