Sign in Join
FPDoc Onlineexperiment

UTF16ToUTF8 function

In unit LazUTF8

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

Declaration

pascal
function UTF16ToUTF8(const S: UnicodeString): AnsiString; overload

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:

trSuccess
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

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.