mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
#10542: Add 4 macros to work with surrogates: Py_UNICODE_IS_SURROGATE, Py_UNICODE_IS_HIGH_SURROGATE, Py_UNICODE_IS_LOW_SURROGATE, Py_UNICODE_JOIN_SURROGATES.
This commit is contained in:
parent
3d1706fa83
commit
8c9375bb59
3 changed files with 34 additions and 0 deletions
|
@ -195,6 +195,27 @@ These APIs can be used for fast direct character conversions:
|
|||
possible. This macro does not raise exceptions.
|
||||
|
||||
|
||||
These APIs can be used to work with surrogates:
|
||||
|
||||
.. c:macro:: Py_UNICODE_IS_SURROGATE(ch)
|
||||
|
||||
Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``).
|
||||
|
||||
.. c:macro:: Py_UNICODE_IS_HIGH_SURROGATE(ch)
|
||||
|
||||
Check if *ch* is an high surrogate (``0xD800 <= ch <= 0xDBFF``).
|
||||
|
||||
.. c:macro:: Py_UNICODE_IS_LOW_SURROGATE(ch)
|
||||
|
||||
Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``).
|
||||
|
||||
.. c:macro:: Py_UNICODE_JOIN_SURROGATES(high, low)
|
||||
|
||||
Join two surrogate characters and return a single Py_UCS4 value.
|
||||
*high* and *low* are respectively the leading and trailing surrogates in a
|
||||
surrogate pair.
|
||||
|
||||
|
||||
Plain Py_UNICODE
|
||||
""""""""""""""""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue