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.
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index 6e163d6..4222a05 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -396,6 +396,7 @@
 
    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 @@
    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
 """""""""""""""