[Overview][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'LazUTF8' (#lazutils)

FindInvalidUTF8Codepoint

Finds the position where an invalid UTF-8 codepoint is found in the string.

Declaration

Source position: lazutf8.pas line 132

function FindInvalidUTF8Codepoint(

  p: PChar;

  Count: PtrInt;

  StopOnNonUTF8: Boolean = True

):PtrInt;

Arguments

p

  

Values to examine in the function.

Count

  

Length of the input values.

StopOnNonUTF8

  

True to exit on an malformed codepoint.

Function result

Offset into the string for the error.

Description

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).


Version 3.2 Generated 2024-02-25 Home