mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +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
|
@ -1268,6 +1268,16 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefaultAndSize(
|
|||
Py_ssize_t size /* size */
|
||||
);
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(PyObject*) PyUnicode_EncodeFSDefault(
|
||||
PyObject *unicode
|
||||
);
|
||||
|
||||
/* --- Methods & Slots ----------------------------------------------------
|
||||
|
||||
These are capable of handling Unicode objects and strings on input
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue