I wish to peek a byte of the binary data coming in using binary reader. Using PeekChar works fine only if it is UTF-8. Otherwise, I get the error "The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)' fallback".
Is there a way for binary reader to peek one byte irrespective of the encoding?
Stream stream = new MemoryStream(buffer);
BinaryReader reader = new BinaryReader(stream);
type = (uint)reader.PeekChar(); // Throws error I mentioned for a particular case