RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.Utf8ToUnicode Function

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

Pascal
function Utf8ToUnicode(Dest: PWideChar; Source: PChar; MaxChars: Integer): Integer; overload; deprecated;
function Utf8ToUnicode(Dest: PWideChar; MaxDestChars: Cardinal; Source: PChar; SourceBytes: Cardinal): Cardinal; overload;
C++
int Utf8ToUnicode(PWideChar Dest, const char * Source, int MaxChars);
unsigned Utf8ToUnicode(PWideChar Dest, unsigned MaxDestChars, const char * Source, unsigned SourceBytes);

System

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

 

UCS4StringToWideString 

UnicodeToUtf8 

Utf8Encode 

Utf8Decode 

UTF8String

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!