Availability:C-language interface function
int PL_utf8_code_point(const
char **in, const char *end, int *cp)Decode the UTF-8 sequence at in into the code point cp
and advance in past it. The sequence ends before end.
If
end is NULL, the input is a 0-terminated string:
the decoder never reads past the 0-byte. Returns the number of bytes
consumed, or -1 if the sequence is invalid. Only the shortest encoding
of a code point up to U+10FFFF is valid. An invalid sequence consumes
one byte and returns that byte in cp, except for a surrogate
(U+D800 ... U+DFFF), which consumes the sequence and returns U+FFFD.
This is the decoder Prolog uses for UTF-8 text, so foreign code using it
agrees with Prolog on, e.g., the number of characters in invalid UTF-8.
ASCII is decoded inline.