PEP 540: Fix effects of the PEP 538 · python/peps@71cda51 (original) (raw)

`@@ -144,9 +144,15 @@ The POSIX locale enables the locale coercion (PEP 538) and the UTF-8

`

144

144

`mode (PEP 540). When the locale coercion is enabled, enabling the UTF-8

`

145

145

`mode has no (additional) effect.

`

146

146

``

147

``

`-

Locale coercion only impacts non-Python code like C libraries, whereas

`

148

``

`-

the Python UTF-8 Mode only impacts Python code: the two PEPs are

`

149

``

`-

complementary.

`

``

147

`+

The UTF-8 has the same effect than locale coercion:

`

``

148


``sys.getfilesystemencoding()`` returns ``'UTF-8'``,

``

149


``locale.getpreferredencoding()`` returns ``UTF-8``, ``sys.stdin`` and

``

150


``sys.stdout`` error handler set to ``surrogateescape``. These changes

``

151

`+

only affect Python code. But the locale coercion has addiditonal

`

``

152


effects: the ``LC_CTYPE`` environment variable and the ``LC_CTYPE``

``

153


locale are set to a UTF-8 locale like ``C.UTF-8``. The side effect is

``

154

`+

that non-Python code is also impacted by the locale coercion. The two

`

``

155

`+

PEPs are complementary.

`

150

156

``

151

157

`On platforms where locale coercion is not supported like Centos 7, the

`

152

158

`POSIX locale only enables the UTF-8 Mode. In this case, Python code uses

`