mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
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:
parent
59e62db0a3
commit
ae6265f8d0
10 changed files with 46 additions and 26 deletions
|
@ -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
|
||||
"""""""""""""""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue