From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function UnicodeToUtf8(Dest: _PAnsiChr; Source: PWideChar; MaxBytes: Integer): Integer;
function UnicodeToUtf8(Dest: _PAnsiChr; MaxDestBytes: Cardinal; Source: PWideChar; SourceChars: Cardinal): Cardinal;


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


Type Visibility Source Unit Parent
function public
System System


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

Call UnicodeToUtf8 to convert a Unicode string to a null-terminated sequence of UTF-8 characters. Use the second syntax. The deprecated syntax is included only for backward compatibility.

Dest receives the resulting null-terminated array of UTF-8 characters.

MaxDestBytes or MaxBytes indicates the number of bytes available in the buffer specified by Dest, including the byte for the null terminator.

Source is an array of Unicode characters.

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

UnicodeToUtf8 returns the number of bytes written to Dest.

See Also

Code Examples