[Overview][Types][Classes][Procedures and functions][Variables][Index] |
Encodes the given code point as an UTF-8 sequence of 1 to 4 bytes.
Source position: lazutf8.pas line 90
function UnicodeToUTF8( |
CodePoint: Cardinal |
):string; |
CodePoint: Cardinal; |
Buf: PChar |
):Integer; |
CodePoint |
|
Unicode character value to convert in the function. |
Number of bytes needed for the UTF-8-encoded value.
CodePoint |
|
Unicode character value to convert in the function. |
Buf |
|
Stores the UTF-8-encoded byte values for the codepoint. |
UnicodeToUTF8 is an Integer function used to convert the Unicode character value in CodePoint to the sequence of bytes needed for the UTF-8 encoding. UnicodeToUTF8 stores the UTF-8-encoded byte values for the Unicode character in the Buf parameter.
The return value contains the number of bytes required for the UTF-8-encoded value (in the range 1..4). If it contains 0 (zero), the Unicode codepoint was invalid and an Exception is raised.
Remark: | UnicodeToUTF8 does not process #0 byte values for the codepoint, as done for UTF-32. |
Raises an Exception when Utf8TryFindCodepointStartCodePoint is an invalid Unicode character value. Raised with the message 'UnicodeToUTF8: invalid Unicode: XXXXXXXX'.
Version 3.2 | Generated 2024-02-25 | Home |