Skip to content

Commit

Permalink
PEP 540: Fix effects of the PEP 538
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Dec 10, 2017
1 parent b65d068 commit 71cda51
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pep-0540.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:

This comment has been minimized.

Copy link
@methane

methane Dec 10, 2017

Member

"The UTF-8 mode"

This comment has been minimized.

Copy link
@vstinner

vstinner Dec 10, 2017

Author Member

Oops, fixed by commit 08224bf

``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
Expand Down

0 comments on commit 71cda51

Please sign in to comment.