[docs] Wrong C API documentation for locale encoding (issue 16323)
storchaka at gmail.com
storchaka at gmail.com
Sat Oct 27 20:06:28 CEST 2012
Reviewers: ,
http://bugs.python.org/review/16323/diff/6415/Doc/c-api/unicode.rst
File Doc/c-api/unicode.rst (right):
http://bugs.python.org/review/16323/diff/6415/Doc/c-api/unicode.rst#newcode741
Doc/c-api/unicode.rst:741: *errors* is equal to ``strict``, otherwise it
uses the
I think that should be just explicitly said, that only 'strict' and
'surrogateescape' error handlers are supported.
Please review this at http://bugs.python.org/review/16323/
Affected files:
Doc/c-api/unicode.rst
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -730,47 +730,47 @@ 3.x, but need to be aware that their use
Locale Encoding
"""""""""""""""
The current locale encoding can be used to decode text from the operating
system.
-.. c:function:: PyObject* PyUnicode_DecodeLocaleAndSize(const char *str, Py_ssize_t len, int surrogateescape)
+.. c:function:: PyObject* PyUnicode_DecodeLocaleAndSize(const char *str, Py_ssize_t len, const char *errors)
Decode a string from the current locale encoding. The decoder is strict if
- *surrogateescape* is equal to zero, otherwise it uses the
+ *errors* is equal to ``strict``, otherwise it uses the
``'surrogateescape'`` error handler (:pep:`383`) to escape undecodable
bytes. If a byte sequence can be decoded as a surrogate character and
- *surrogateescape* is not equal to zero, the byte sequence is escaped using
+ *errors* is not equal to ``strict``, the byte sequence is escaped using
the ``'surrogateescape'`` error handler instead of being decoded. *str*
must end with a null character but cannot contain embedded null characters.
.. seealso::
Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from
:c:data:`Py_FileSystemDefaultEncoding` (the locale encoding read at
Python startup).
.. versionadded:: 3.3
-.. c:function:: PyObject* PyUnicode_DecodeLocale(const char *str, int surrogateescape)
+.. c:function:: PyObject* PyUnicode_DecodeLocale(const char *str, const char *errors)
Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string
length using :c:func:`strlen`.
.. versionadded:: 3.3
-.. c:function:: PyObject* PyUnicode_EncodeLocale(PyObject *unicode, int surrogateescape)
+.. c:function:: PyObject* PyUnicode_EncodeLocale(PyObject *unicode, const char *errors)
Encode a Unicode object to the current locale encoding. The encoder is
- strict if *surrogateescape* is equal to zero, otherwise it uses the
+ strict if *errors* is equal to ``strict``, otherwise it uses the
``'surrogateescape'`` error handler (:pep:`383`). Return a :class:`bytes`
object. *str* cannot contain embedded null characters.
.. seealso::
Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to
:c:data:`Py_FileSystemDefaultEncoding` (the locale encoding read at
Python startup).
More information about the docs
mailing list