|
noexcept |
Securely converts one multibyte UTF-8 code to a Unicode 11.0 code point.
| [in] | pStatus | receives a status of the conversion. If the conversion succeeds, pStatus receives the number of bytes occupied by the UTF-8 character pointed to by pUtf. If pUtf points to an invalid UTF-8 code, the pStatus parameter receives -1, and the function returns the EILSEQ code. If a runtime constraint is violated by the call, the value of pStatus is not changed. |
| [out] | pUcp | is an optional pointer to a buffer to receive the scalar Unicode code point which corresponds to a code specified by pUtf. |
| [in] | pUtf | is a pointer to a UTF-8 code to be converted to a Unicode code point. |
| [in] | cbUtf | specifies the maximal number of bytes to read from pUtf. |
pUtf does not point to a valid multibyte character.The function implements the conversion of a UTF-8 encoded character to the corresponding Unicode 11.0 code point in a portable way and independently of the current locale.
It is a secure variant of the u8toucp function. Unlike other encoding conversion functions of chsvlib, ucptou8_s does not have a standardized analogue and is introduced to verify that pUtf is not NULL and cbUtf is not greater than RSIZE_MAX. Additionally, unlike ucptou8, the function verifies that the code point appertains to the set of valid codes defined for UTF-8 by the Unicode 11.0 standard.