cf_string_append_UTF8¶
Category: string
GitHub: cute_string.h
Appends a UTF32 codepoint (as uint32_t) encoded as UTF8 onto the string.
| Parameters | Description |
|---|---|
s |
The string. Can be NULL. |
codepoint |
An int codepoint in UTF32 form. |
Code Example¶
Appending UTF32 codepoints as UTF8 in a loop.
sdyna char* s = NULL;
while (has_codepoint()) {
cf_string_append_UTF8(s, get_codepoint());
}
sfree(s);
Remarks¶
The UTF8 bytes are appended onto the string.
Each UTF32 codepoint represents a single character. Each character can be encoded from 1 to 4 bytes. Therefore, this function will push 1 to 4 bytes onto the string.
If an invalid codepoint is found the "replacement character" 0xFFFD will be appended instead, which looks like a question mark inside a dark diamond.