Encodes a raw u32 value as UTF-16 into the provided
and then returns the subslice of the buffer that contains the encoded character.
char::encode_utf16, this method also handles codepoints in the surrogate range.
char in the surrogate range is UB.)
Panics if the buffer is not large enough.
A buffer of length 2 is large enough to encode any