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

ConvertUTF16ToUTF8

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

Declaration

Source position: lazutf8.pas line 209

function ConvertUTF16ToUTF8(

  Dest: PChar;

  DestCharCount: SizeUInt;

  Src: PWideChar;

  SrcWideCharCount: SizeUInt;

  Options: TConvertOptions;

  out ActualCharCount: SizeUInt

):TConvertResult;

Arguments

Dest

  

Pointer to destination string.

DestCharCount

  

Char count allocated in destination string.

Src

  

Pointer to source string.

SrcWideCharCount

  

Wide char count allocated in source string.

Options

  

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

ActualCharCount

  

Actual char count converted from source string to destination string.

Function result

Converted values from the function.

Description

Converts the specified UTF-16 encoded string (system endian) to its UTF-8 encoding.

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

See also

TConvertOptions

  

Stores values from the TConvertOption enumeration.

TConvertOption

  

Indicates options enabled during UTF-8 <-> UTF-16 conversions.

TConvertResult

  

Indicates the result from UTF-8 <-> UTF-16 conversions.


Version 3.2 Generated 2024-02-25 Home