PEP 540: Fix effects of the PEP 538
This commit is contained in:
parent
b65d0681d4
commit
71cda51fbb
12
pep-0540.txt
12
pep-0540.txt
|
@ -144,9 +144,15 @@ The POSIX locale enables the locale coercion (PEP 538) and the UTF-8
|
|||
mode (PEP 540). When the locale coercion is enabled, enabling the UTF-8
|
||||
mode has no (additional) effect.
|
||||
|
||||
Locale coercion only impacts non-Python code like C libraries, whereas
|
||||
the Python UTF-8 Mode only impacts Python code: the two PEPs are
|
||||
complementary.
|
||||
The UTF-8 has the same effect than locale coercion:
|
||||
``sys.getfilesystemencoding()`` returns ``'UTF-8'``,
|
||||
``locale.getpreferredencoding()`` returns ``UTF-8``, ``sys.stdin`` and
|
||||
``sys.stdout`` error handler set to ``surrogateescape``. These changes
|
||||
only affect Python code. But the locale coercion has addiditonal
|
||||
effects: the ``LC_CTYPE`` environment variable and the ``LC_CTYPE``
|
||||
locale are set to a UTF-8 locale like ``C.UTF-8``. The side effect is
|
||||
that non-Python code is also impacted by the locale coercion. The two
|
||||
PEPs are complementary.
|
||||
|
||||
On platforms where locale coercion is not supported like Centos 7, the
|
||||
POSIX locale only enables the UTF-8 Mode. In this case, Python code uses
|
||||
|
|
Loading…
Reference in New Issue