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

UTF8CharacterToUnicode (deprecated)

Returns the codepoint at p and the number of bytes to skip.

Declaration

Source position: lazutf8.pas line 89

function UTF8CharacterToUnicode(

  p: PChar;

  out CharLen: Integer

):Cardinal;

Description

If p=nil then CharLen and result are 0 otherwise CharLen>0. If there is an encoding error the Result is 0 and CharLen=1 to skip forward. It is safe to do: var s: string; p:=1; while p<=length(s) do begin UTF8CharacterToUnicode(@s[p],CharLen); inc(p,CharLen); end; For speed reasons this function only checks for 1,2,3,4 byte encoding errors. Especially it does not check if the codepoint is defined in the unicode table.

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