Go to the source code of this file.
Function Documentation
This converts a UCS2 buffer of the given length to UCS4 buffer. It converts up to ucs4len characters of UCS2
It returns the number of characters converted which can be less than ucs2len if there are surrogate pairs in ucs2.
The return value is the actual size of the used part of the ucs4 buffer.
surrogate pair
<
-0xdc00 + 0x10000
Functions only needed on narrow builds of Python for converting back and forth between the NumPy Unicode data-type (always 4-bytes) and the Python Unicode scalar (2-bytes on a narrow build).
The ucs2 buffer must be large enough to hold 2*ucs4length characters due to the use of surrogate pairs.
The return value is the number of ucs2 bytes used-up which is ucs4length + number of surrogate pairs found.
Values above 0xffff are converted to surrogate pairs.
Returns a PyUnicodeObject initialized from a buffer containing UCS4 unicode.
Parameters
<blockquote>
- src: char *
- Pointer to buffer containing UCS4 unicode.
- size: Py_ssize_t
- Size of buffer in bytes.
- swap: int
- If true, the data will be swapped.
- align: int
- If true, the data will be aligned.
</blockquote>
Returns
new_reference: PyUnicodeObject
swap and align if needed
trim trailing zeros
produce PyUnicode object