mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Docs C API: Clarify what happens when null bytes are passed to PyUnicode_AsUTF8
(#127458)
Co-authored-by: Stan U. <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Tomas R. <tomas.roun8@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
f0f7b978be
commit
e792f4bc2e
1 changed files with 9 additions and 0 deletions
|
@ -1054,6 +1054,15 @@ These are the UTF-8 codec APIs:
|
|||
|
||||
As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size.
|
||||
|
||||
.. warning::
|
||||
|
||||
This function does not have any special behavior for
|
||||
`null characters <https://en.wikipedia.org/wiki/Null_character>`_ embedded within
|
||||
*unicode*. As a result, strings containing null characters will remain in the returned
|
||||
string, which some C functions might interpret as the end of the string, leading to
|
||||
truncation. If truncation is an issue, it is recommended to use :c:func:`PyUnicode_AsUTF8AndSize`
|
||||
instead.
|
||||
|
||||
.. versionadded:: 3.3
|
||||
|
||||
.. versionchanged:: 3.7
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue