Issue #8715: Create PyUnicode_EncodeFSDefault() function: Encode a Unicode

object to Py_FileSystemDefaultEncoding with the "surrogateescape" error
handler, return a bytes object. If Py_FileSystemDefaultEncoding is not set,
fall back to UTF-8.
This commit is contained in:
Victor Stinner 2010-05-15 16:27:27 +00:00
parent 59e62db0a3
commit ae6265f8d0
10 changed files with 46 additions and 26 deletions

View file

@ -396,6 +396,7 @@ used, passsing :func:PyUnicode_FSConverter as the conversion function:
Use :func:`PyUnicode_DecodeFSDefaultAndSize` if you know the string length.
.. cfunction:: PyObject* PyUnicode_DecodeFSDefault(const char *s)
Decode a string using :cdata:`Py_FileSystemDefaultEncoding` and
@ -404,6 +405,16 @@ used, passsing :func:PyUnicode_FSConverter as the conversion function:
If :cdata:`Py_FileSystemDefaultEncoding` is not set, fall back to UTF-8.
.. cfunction:: PyObject* PyUnicode_EncodeFSDefault(PyObject *unicode)
Encode a Unicode object to :cdata:`Py_FileSystemDefaultEncoding` with the
``'surrogateescape'`` error handler, return a :func:`bytes` object.
If :cdata:`Py_FileSystemDefaultEncoding` is not set, fall back to UTF-8.
.. versionadded:: 3.2
wchar_t Support
"""""""""""""""