Encodes UTF-16 text into bytes using the specified encoding.
encoding
public ReadOnlySpan<byte> Encode(ReadOnlySpan<char> text, Encoding encoding)
The text to encode.
The target encoding.