Unicode.utf8_GetCharValidated

Convert a sequence of bytes encoded as UTF-8 to a Unicode character. This function checks for incomplete characters, for invalid characters such as characters that are out of the range of Unicode, and for overlong encodings of valid characters.

class Unicode
static
utf8_GetCharValidated
(
string p
,)

Parameters

p string

a pointer to Unicode character encoded as UTF-8

maxLen gssize

the maximum number of bytes to read, or -1, for no maximum or if p is nul-terminated

Return Value

Type: gunichar

the resulting character. If p points to a partial sequence at the end of a string that could begin a valid character (or if max_len is zero), returns (gunichar)-2; otherwise, if p does not point to a valid UTF-8 encoded Unicode character, returns (gunichar)-1.

Meta