Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8477f82

Browse files
committed
#8648: document UTF-7 codec functions.
1 parent 07b90ca commit 8477f82

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Doc/c-api/unicode.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,38 @@ These are the UTF-16 codec APIs:
670670
Return *NULL* if an exception was raised by the codec.
671671

672672

673+
UTF-7 Codecs
674+
""""""""""""
675+
676+
These are the UTF-7 codec APIs:
677+
678+
679+
.. cfunction:: PyObject* PyUnicode_DecodeUTF7(const char *s, Py_ssize_t size, const char *errors)
680+
681+
Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string
682+
*s*. Return *NULL* if an exception was raised by the codec.
683+
684+
685+
.. cfunction:: PyObject* PyUnicode_DecodeUTF8Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed)
686+
687+
If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeUTF7`. If
688+
*consumed* is not *NULL*, trailing incomplete UTF-7 base-64 sections will not
689+
be treated as an error. Those bytes will not be decoded and the number of
690+
bytes that have been decoded will be stored in *consumed*.
691+
692+
693+
.. cfunction:: PyObject* PyUnicode_EncodeUTF7(const Py_UNICODE *s, Py_ssize_t size, int base64SetO, int base64WhiteSpace, const char *errors)
694+
695+
Encode the :ctype:`Py_UNICODE` buffer of the given size using UTF-7 and
696+
return a Python bytes object. Return *NULL* if an exception was raised by
697+
the codec.
698+
699+
If *base64SetO* is nonzero, "Set O" (punctuation that has no otherwise
700+
special meaning) will be encoded in base-64. If *base64WhiteSpace* is
701+
nonzero, whitespace will be encoded in base-64. Both are set to zero for the
702+
Python "utf-7" codec.
703+
704+
673705
Unicode-Escape Codecs
674706
"""""""""""""""""""""
675707

0 commit comments

Comments
 (0)