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

FindInvalidUTF8Character (deprecated)

Returns -1 if ok, otherwise byte index of invalid UTF8 codepoint

Declaration

Source position: lazutf8.pas line 135

function FindInvalidUTF8Character(

  p: PChar;

  Count: PtrInt;

  StopOnNonUTF8: Boolean = True

):PtrInt;

Description

It always stops on irregular codepoints. For example Codepoint 0 is normally encoded as #0, but it can also be encoded as #192#0. Because most software does not check this, it can be exploited and is a security risk. If StopOnNonUTF8 is false it will ignore undefined codes. For example #128. By default it stops on such codes.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.