summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-05-15 16:27:27 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-05-15 16:27:27 (GMT)
commitae6265f8d06dbec7d08c73ca23dad0f040d09b8e (patch)
tree3598426233e690b284bce322194f51be94ab6799 /Include
parent59e62db0a39eb89930ed3ae1730726cd15b7d640 (diff)
downloadcpython-ae6265f8d06dbec7d08c73ca23dad0f040d09b8e.zip
cpython-ae6265f8d06dbec7d08c73ca23dad0f040d09b8e.tar.gz
cpython-ae6265f8d06dbec7d08c73ca23dad0f040d09b8e.tar.bz2
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.
Diffstat (limited to 'Include')
-rw-r--r--Include/unicodeobject.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 383187b..ddc9000 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -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