[Overview][Procedures and functions][Index] Reference for unit 'LazUTF16' (#lazutils)

UTF16CharacterToUnicode

Converts ordinal values for UTF-16 code points in p to its Unicode equivalent.

Declaration

Source position: lazutf16.pas line 44

function UTF16CharacterToUnicode(

  p: PWideChar;

  out CharLen: Integer

):Cardinal;

Arguments

p

  

UTF-16 code points examined and converted in the routine.

CharLen

  

Number of UTF-16 code points for the converted character.

Function result

Unicode code point for the values in p.

Description

UTF16CharacterToUnicode converts 16-bit values in p to the equivalent Unicode value.

Unpaired surrogates are invalid in any UTFs. These include any value in the range $D800..$DBFF not followed by a value in the range $DC00..$DFFF, or any value in the range $DC00..$DFFF not preceded by a value in the range $D800..$DBFF.

UTF16CharacterToUnicode ensures that ordinal value(s) in the reserved range(s) are converted to the correct Unicode value. CharLen is updated to reflect whether the values in p are a character represented by a single UTF-16 code point (1), or requires 2 code points for the surrogate pair (2). It is set to 0 when p contains an invalid UTF-16 code point.

The return value contains the Cardinal value for the Unicode code point, or 0 when p contains an invalid UTF-16 code point.


Version 3.2 Generated 2024-02-25 Home