Encodes a raw u32 value as UTF-8 into the provided byte buffer, and then returns the subslice of the buffer that contains the encoded character.
char::encode_utf8, this method also handles codepoints in the surrogate range.
char in the surrogate range is UB.)
The result is valid generalized UTF-8 but not valid UTF-8.
Panics if the buffer is not large enough.
A buffer of length four is large enough to encode any