mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Close #11022: TextIOWrapper doesn't call locale.setlocale() anymore
open() and io.TextIOWrapper are now calling locale.getpreferredencoding(False) instead of locale.getpreferredencoding() in text mode if the encoding is not specified. Don't change temporary the locale encoding using locale.setlocale(), use the current locale encoding instead of the user preferred encoding. Explain also in open() documentation that locale.getpreferredencoding(False) is called if the encoding is not specified.
This commit is contained in:
parent
91c5a34613
commit
f86a5e8a93
8 changed files with 84 additions and 29 deletions
|
@ -800,9 +800,10 @@ are always available. They are listed here in alphabetical order.
|
|||
already exists), ``'x'`` for exclusive creation and ``'a'`` for appending
|
||||
(which on *some* Unix systems, means that *all* writes append to the end of
|
||||
the file regardless of the current seek position). In text mode, if
|
||||
*encoding* is not specified the encoding used is platform dependent. (For
|
||||
reading and writing raw bytes use binary mode and leave *encoding*
|
||||
unspecified.) The available modes are:
|
||||
*encoding* is not specified the encoding used is platform dependent:
|
||||
``locale.getpreferredencoding(False)`` is called to get the current locale
|
||||
encoding. (For reading and writing raw bytes use binary mode and leave
|
||||
*encoding* unspecified.) The available modes are:
|
||||
|
||||
========= ===============================================================
|
||||
Character Meaning
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue