Well it depends whether you parsing binary (byte stream) or text (character stream).
In practice, lots of text formats (JSON, XML) embed or hint the character encoding in the format.