Unit 'System' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#rtl]

Utf8ToUnicode

Convert a buffer with UTF-8 characters to widestring characters.

Declaration

Source position: ustringh.inc line 140

function Utf8ToUnicode(

  Dest: PUnicodeChar;

  Source: PAnsiChar;

  MaxChars: SizeInt

):SizeInt;

function Utf8ToUnicode(

  Dest: PUnicodeChar;

  MaxDestChars: SizeUInt;

  Source: PAnsiChar;

  SourceBytes: SizeUInt

):SizeUInt;

function Utf8ToUnicode(

  Dest: PUnicodeChar;

  MaxDestChars: SizeUInt;

  Source: PAnsiChar;

  SourceBytes: SizeUInt;

  IgnoreInvalid: Boolean

):SizeUInt;

Description

Utf8ToUnicode converts the buffer in Source with a length of SourceBytes or for a maximum length of MaxChars (or MaxDestChars) widestring characters to the buffer pointed to by Dest. If Dest is Nil it will return the number of widechars needed to convert the UTF8. if MaxDestChars allows for a null terminator, then it is also added to the output.

The function returns the number of copied widestring characters, or, if Dest is Nil, then it will return the number of characters needed to perform the conversion.

Errors

On error, -1 is returned.

See also

UnicodeToUTF8

  

Convert a unicode (UTF16) string to a UTF8 string

UTF8Encode

  

Convert a widestring or unicodestring to an UTF-8 encoded ansistring.

UTF8Decode

  

Convert an UTF-8 encoded ansistring to a unicodestring.

Utf8ToAnsi

  

Convert a UTF-8 encoded Unicode string to an ansistring.

SetWideStringManager

  

Set the widestring manager.


Documentation generated on: Jul 15 2025