Sign in Join
FPDoc Onlineexperiment

Utf8ToUnicode function

In unit System

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

Declaration

pascal
function Utf8ToUnicode(Dest: PUnicodeChar; Source: PAnsiChar; 
 MaxChars: SizeInt): SizeInt

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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.