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

IsUTF16CharValid

Returns True if the specified values are a valid UTF-16 character (codepoint).

Declaration

Source position: lazutf16.pas line 46

function IsUTF16CharValid(

  AChar: WideChar;

  ANextChar: WideChar

):Boolean;

Arguments

AChar

  

First UTF-16 code examined in the method.

ANextChar

  

Next UTF-16 code examined in the method.

Function result

Returns False if AChar is #0 or AChar and ANextChar are unpaired surrogates.

Description

Based on the specification defined by the Unicode consortium, at:

http://unicode.org/faq/utf_bom.html#utf16-7

Q: Are there any 16-bit values that are invalid?

A: Unpaired surrogates are invalid in UTFs. These include any value in the range D800 to DBFF not followed by a value in the range DC00 to DFFF, or any value in the range DC00 to DFFF not preceded by a value in the range D800 to DBFF. [AF]

If ANextChar is set to #0 there is no next character.


Version 3.2 Generated 2024-02-25 Home