20 namespace strings_internal {
23 if (utf8_char <= 0x7F) {
24 *buffer =
static_cast<char>(utf8_char);
26 }
else if (utf8_char <= 0x7FF) {
27 buffer[1] = 0x80 | (utf8_char & 0x3F);
29 buffer[0] = 0xC0 | utf8_char;
31 }
else if (utf8_char <= 0xFFFF) {
32 buffer[2] = 0x80 | (utf8_char & 0x3F);
34 buffer[1] = 0x80 | (utf8_char & 0x3F);
36 buffer[0] = 0xE0 | utf8_char;
39 buffer[3] = 0x80 | (utf8_char & 0x3F);
41 buffer[2] = 0x80 | (utf8_char & 0x3F);
43 buffer[1] = 0x80 | (utf8_char & 0x3F);
45 buffer[0] = 0xF0 | utf8_char;
size_t EncodeUTF8Char(char *buffer, char32_t utf8_char)