[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-04 Thread STINNER Victor
STINNER Victor added the comment: > But locale encoding and console cp are different on Windows. Users may want > to know console cp even when they want to use UTF-8 by default for > reading/writing text files. You're right. My final change leaves Windows unchanged. -- resolution:

[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-04 Thread STINNER Victor
STINNER Victor added the comment: New changeset 3529718925f40d14ed48d281d809187bc7314a14 by Victor Stinner in branch 'master': bpo-42236: os.device_encoding() respects UTF-8 Mode (GH-23119) https://github.com/python/cpython/commit/3529718925f40d14ed48d281d809187bc7314a14 --

[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-02 Thread Inada Naoki
Inada Naoki added the comment: I don't think UTF-8 mode should override os.device_encoding() on Windows. UTF-8 mode can be used to ignore legacy locale encoding, and os.device_encoding() uses the locale encoding on Unix. So overriding it make sense. But locale encoding and console cp are

[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-02 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +22036 pull_request: https://github.com/python/cpython/pull/23119 ___ Python tracker ___

[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-02 Thread STINNER Victor
STINNER Victor added the comment: New changeset 4b9aad49992a825d8c76e428ed1aca81dd3878b2 by Victor Stinner in branch 'master': bpo-42236: Enhance init and encoding documentation (GH-23109) https://github.com/python/cpython/commit/4b9aad49992a825d8c76e428ed1aca81dd3878b2 --

[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-02 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +22026 pull_request: https://github.com/python/cpython/pull/23109 ___ Python tracker ___

[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-01 Thread STINNER Victor
STINNER Victor added the comment: New changeset e662c398d87f136497f8ec672e83657ae3a599e0 by Victor Stinner in branch 'master': bpo-42236: Use UTF-8 encoding if nl_langinfo(CODESET) fails (GH-23086) https://github.com/python/cpython/commit/e662c398d87f136497f8ec672e83657ae3a599e0 --

[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-01 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +22003 pull_request: https://github.com/python/cpython/pull/23086 ___ Python tracker ___

[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-01 Thread STINNER Victor
STINNER Victor added the comment: New changeset 82458b6cdbae3b849dc11d0d7dc2ab06ef0451c4 by Victor Stinner in branch 'master': bpo-42236: Enhance _locale._get_locale_encoding() (GH-23083) https://github.com/python/cpython/commit/82458b6cdbae3b849dc11d0d7dc2ab06ef0451c4 --

[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-01 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +22001 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23083 ___ Python tracker ___

[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-01 Thread STINNER Victor
STINNER Victor added the comment: In bpo-42208, I added C _Py_GetLocaleEncoding() function and Python _locale._get_locale_encoding() function. -- ___ Python tracker ___

[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-01 Thread STINNER Victor
New submission from STINNER Victor : When the UTF-8 Mode is enabled, sys.stdout.encoding is always UTF-8, whereas os.devide_encoding(sys.stdout.fileno()) returns the locale encoding. os.devide_encoding() must return UTF-8 when the UTF-8 Mode is used. -- components: Library (Lib)