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

ConvertUTF8ToUTF16

Converts values from UTF-8 encoding to UTF-16 encoding.

Declaration

Source position: lazutf8.pas line 205

function ConvertUTF8ToUTF16(

  Dest: PWideChar;

  DestWideCharCount: SizeUInt;

  Src: PChar;

  SrcCharCount: SizeUInt;

  Options: TConvertOptions;

  out ActualWideCharCount: SizeUInt

):TConvertResult;

Arguments

Dest

  

Pointer to destination string.

DestWideCharCount

  

Wide char count allocated in destination string.

Src

  

Pointer to source string.

SrcCharCount

  

Char count allocated in source string.

Options

  

Conversion options, if none is set, both invalid and unfinished source chars are skipped.

ActualWideCharCount

  

Actual WideChar count used int he conversion.

Function result

Converted values from the function.

Description

ConvertUTF8ToUTF16 is used to convert the specified UTF-8 encoded string to UTF-16 encoded (system endian).

Options indicates the conversion options enabled in the function, and can include the following values:

toInvalidCharError
Stop on invalid source char and report error
toInvalidCharToSymbol
Replace invalid source chars with '?'
toUnfinishedCharError
Stop on unfinished source char and report error
toUnfinishedCharToSymbol
Replace unfinished source char with '?'

The return value is a value from the TConvertResult enumeration, including:

trNoError
The string was successfully converted without any error
trNullSrc
Pointer to source string is nil
trNullDest
Pointer to destination string is nil
trDestExhausted
Destination buffer size is not big enough to hold converted string
trInvalidChar
Invalid source char has occurred
trUnfinishedChar
Unfinished source char has occurred

Version 3.2 Generated 2024-02-25 Home