diff options
author | Steve Dower <steve.dower@microsoft.com> | 2016-09-08 17:35:16 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2016-09-08 17:35:16 (GMT) |
commit | cc16be85c0b7119854c00fb5c666825deef641cf (patch) | |
tree | 18b9a8020679f8a0e6e0dd1ecb5668024be499b7 /Doc/whatsnew | |
parent | cfbd48bc56980823dd8e2560e0ce4e46e33e4e3d (diff) | |
download | cpython-cc16be85c0b7119854c00fb5c666825deef641cf.zip cpython-cc16be85c0b7119854c00fb5c666825deef641cf.tar.gz cpython-cc16be85c0b7119854c00fb5c666825deef641cf.tar.bz2 |
Issue #27781: Change file system encoding on Windows to UTF-8 (PEP 529)
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.6.rst | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst index f2b53fb..ce1c44e 100644 --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -76,6 +76,8 @@ Security improvements: Windows improvements: +* PEP 529: :ref:`Change Windows filesystem encoding to UTF-8 <pep-529>` + * The ``py.exe`` launcher, when used interactively, no longer prefers Python 2 over Python 3 when the user doesn't specify a version (via command line arguments or a config file). Handling of shebang lines @@ -218,6 +220,33 @@ evaluated at run time, and then formatted using the :func:`format` protocol. See :pep:`498` and the main documentation at :ref:`f-strings`. +.. _pep-529: + +PEP 529: Change Windows filesystem encoding to UTF-8 +---------------------------------------------------- + +Representing filesystem paths is best performed with str (Unicode) rather than +bytes. However, there are some situations where using bytes is sufficient and +correct. + +Prior to Python 3.6, data loss could result when using bytes paths on Windows. +With this change, using bytes to represent paths is now supported on Windows, +provided those bytes are encoded with the encoding returned by +:func:`sys.getfilesystemencoding()`, which now defaults to ``'utf-8'``. + +Applications that do not use str to represent paths should use +:func:`os.fsencode()` and :func:`os.fsdecode()` to ensure their bytes are +correctly encoded. To revert to the previous behaviour, set +:envvar:`PYTHONLEGACYWINDOWSFSENCODING` or call +:func:`sys._enablelegacywindowsfsencoding`. + +See :pep:`529` for more information and discussion of code modifications that +may be required. + +.. note:: + + This change is considered experimental for 3.6.0 beta releases. The default + encoding may change before the final release. PEP 487: Simpler customization of class creation ------------------------------------------------ |