From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function Utf8ToUnicode(Dest: PWideChar; Source: _PAnsiChr; MaxChars: Integer): Integer;
function Utf8ToUnicode(Dest: PWideChar; MaxDestChars: Cardinal; Source: _PAnsiChr; SourceBytes: Cardinal): Cardinal;


extern DELPHI_PACKAGE int __fastcall Utf8ToUnicode _DEPRECATED_ATTRIBUTE0 (WideChar * Dest, char * Source, int MaxChars)/* overload */;


Type Visibility Source Unit Parent
function public
System System


Converts a string of UTF-8 characters to a Unicode string.

Call Utf8ToUnicode to convert a UTF-8 string to Unicode. Use the second syntax. The deprecated syntax is provided for backward compatibility only.

Dest receives the resulting null-terminated array of Unicode characters.

MaxDestChars or MaxChars indicates the maximum number of Unicode characters that the buffer specified by Dest can hold, not counting the null terminator.

Source is an array of UTF-8 characters.

SourceBytes is the number of bytes in Source. If SourceBytes is not specified, Source must be null-terminated.

Utf8ToUnicode returns the number of characters written to Dest.

In case of errors, the Utf8ToUnicode ... : Cardinal variant returns Cardinal(-1) == $FFFFFFFF and the Utf8ToUnicode ... : Integer returns -1.

See Also