This is the Decoder class. It allows you to transfer byte data to char data, while maintaining sufficient state for the correct processing of partial code points:
Encoding.UTF8.GetDecoder().GetChars(buffer, 0, 1024, charBuffer, 0)
Of course, when the code point is split in the middle, the Decoder remains with the "partial char" in its state, but this does not concern you in your case (and preferably in all other use cases :)).
source share