VgaGames4 - miscellaneous man-pages

[.. upper level ..]

vg4->misc->utf8_from_codepoint()

Get UTF8-character from an Unicode-codepoint.

SYNTAX
int vg4->misc->utf8_from_codepoint(int codept, char *cbuf)

FUNCTION PARAMETERS
codept Unicode-codepoint
cbuf For returning UTF8-character, if not NULL. Will not be null-terminated! Should have at least 6 bytes.

RETURN VALUE
Returns of how many bytes UTF8-character consists, or 0 = invalid Unicode-codepoint

DESCRIPTION
Get UTF8-character from an Unicode-codepoint.

EXAMPLE
/* show UTF8-character of codept */
const int codept = 246;
char cbuf[8];
int no_bytes;

no_bytes = vg4->misc->utf8_from_codepoint(codept, cbuf);
printf("UTF8-character: codepoint = %d, number of bytes = %d: %.*s\n", codept, no_bytes, no_bytes, cbuf);

Output:
UTF8-character: codepoint = 246, number of bytes = 2: รถ

SEE ALSO
vg4->misc->utf8_next()