FindInvalidUTF8Codepoint function
Finds the position where an invalid UTF-8 codepoint is found in the string.
Declaration
function FindInvalidUTF8Codepoint(p: PChar; Count: PtrInt;
StopOnNonUTF8: Boolean=True): PtrIntDescription
FindInvalidUTF8Codepoint is a
PtrInt function used to
find the position where an invalid UTF-8 codepoint is located in the
specified value. The return value contains
-1 when none of the values
in p are invalid, or the zero-based offset into p where the invalid encoding
was located.
StopOnNonUTF8 indicates if the function should exit when an
encoded value is found that is not defined for the UTF-8 encoding, or for
single byte characters inserted in the middle of a UTF-8 encoding (used in
XSS attacks).
An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.
