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

UTF16ToUTF8

Converts a UTF-16-encoded string (system endian) to UTF-8 encoding.

Declaration

Source position: lazutf8.pas line 215

function UTF16ToUTF8(

  const S: UnicodeString

):AnsiString; overload;

function UTF16ToUTF8(

  const P: PWideChar;

  WideCnt: SizeUInt

):AnsiString; overload;

Arguments

S

  

Source UTF-16 string (system endian).

Function result

UTF-8-encoded string.

Arguments

P

  

Pointer to the Source UTF-16 string (system endian).

WideCnt

  

Number of WideChar values in the source string.

Description

UTF16ToUTF8 is a TConvertResult function used to convert the specified UTF-16-encoded string (system endian) to UTF-8 encoding.

The return value is a TConvertResult enumeration value, and includes:

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

TConvertResult

  

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


Version 3.2 Generated 2024-02-25 Home