pub fn char_to_utf8(codepoint: TCodepoint) -> Vec<u8> ⓘExpand description
Encode a codepoint into UTF-8 bytes.
Faithful to C++ CharToUTF8: it does not validate surrogates and
produces 1–4 bytes for codepoints in 0..=0x10FFFF. Codepoints
above 0x10FFFF are debug-checked in C++; here we still encode
using the 4-byte form (the low 21 bits), never panicking.