@@ -802,10 +802,11 @@ File System Encoding
802802""""""""""""""""""""
803803
804804To encode and decode file names and other environment strings,
805- :c:data:`Py_FileSystemEncoding` should be used as the encoding, and
806- ``"surrogateescape"`` should be used as the error handler (:pep: `383 `). To
807- encode file names during argument parsing, the ``"O&"`` converter should be
808- used, passing :c:func:`PyUnicode_FSConverter` as the conversion function:
805+ :c:data:`Py_FileSystemDefaultEncoding` should be used as the encoding, and
806+ :c:data:`Py_FileSystemDefaultEncodeErrors` should be used as the error handler
807+ (:pep: `383 ` and :pep: `529 `). To encode file names to :class:`bytes` during
808+ argument parsing, the ``"O&"`` converter should be used, passing
809+ :c:func:`PyUnicode_FSConverter` as the conversion function:
809810
810811.. c:function:: int PyUnicode_FSConverter(PyObject* obj, void* result)
811812
@@ -820,8 +821,9 @@ used, passing :c:func:`PyUnicode_FSConverter` as the conversion function:
820821 .. versionchanged :: 3.6
821822 Accepts a :term: `path-like object `.
822823
823- To decode file names during argument parsing, the ``"O&" `` converter should be
824- used, passing :c:func: `PyUnicode_FSDecoder ` as the conversion function:
824+ To decode file names to :class: `str ` during argument parsing, the ``"O&" ``
825+ converter should be used, passing :c:func: `PyUnicode_FSDecoder ` as the
826+ conversion function:
825827
826828.. c :function :: int PyUnicode_FSDecoder (PyObject* obj, void* result)
827829
@@ -840,7 +842,7 @@ used, passing :c:func:`PyUnicode_FSDecoder` as the conversion function:
840842.. c :function :: PyObject* PyUnicode_DecodeFSDefaultAndSize (const char *s, Py_ssize_t size)
841843
842844 Decode a string using :c:data: `Py_FileSystemDefaultEncoding ` and the
843- `` "surrogateescape" `` error handler, or `` "strict" `` on Windows .
845+ :c:data: ` Py_FileSystemDefaultEncodeErrors ` error handler.
844846
845847 If :c:data: `Py_FileSystemDefaultEncoding ` is not set, fall back to the
846848 locale encoding.
@@ -854,28 +856,28 @@ used, passing :c:func:`PyUnicode_FSDecoder` as the conversion function:
854856
855857 The :c:func: `Py_DecodeLocale ` function.
856858
857- .. versionchanged :: 3.2
858- Use `` "strict" `` error handler on Windows .
859+ .. versionchanged :: 3.6
860+ Use :c:data: ` Py_FileSystemDefaultEncodeErrors ` error handler.
859861
860862
861863.. c :function :: PyObject* PyUnicode_DecodeFSDefault (const char *s)
862864
863865 Decode a null-terminated string using :c:data: `Py_FileSystemDefaultEncoding `
864- and the `` "surrogateescape" `` error handler, or `` "strict" `` on Windows .
866+ and the :c:data: ` Py_FileSystemDefaultEncodeErrors ` error handler.
865867
866868 If :c:data: `Py_FileSystemDefaultEncoding ` is not set, fall back to the
867869 locale encoding.
868870
869871 Use :c:func: `PyUnicode_DecodeFSDefaultAndSize ` if you know the string length.
870872
871- .. versionchanged :: 3.2
872- Use `` "strict" `` error handler on Windows .
873+ .. versionchanged :: 3.6
874+ Use :c:data: ` Py_FileSystemDefaultEncodeErrors ` error handler.
873875
874876
875877.. c :function :: PyObject* PyUnicode_EncodeFSDefault (PyObject *unicode)
876878
877879 Encode a Unicode object to :c:data: `Py_FileSystemDefaultEncoding ` with the
878- `` "surrogateescape" `` error handler, or `` "strict" `` on Windows , and return
880+ :c:data: ` Py_FileSystemDefaultEncodeErrors ` error handler, and return
879881 :class: `bytes `. Note that the resulting :class: `bytes ` object may contain
880882 null bytes.
881883
@@ -892,6 +894,8 @@ used, passing :c:func:`PyUnicode_FSDecoder` as the conversion function:
892894
893895 .. versionadded :: 3.2
894896
897+ .. versionchanged :: 3.6
898+ Use :c:data: `Py_FileSystemDefaultEncodeErrors ` error handler.
895899
896900wchar_t Support
897901"""""""""""""""
0 commit comments