.NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library
by Brad Abrams
Description
The System.IO.StreamWriter class is designed for character output in a particular System.Text.Encoding, whereas subclasses of System.IO.Stream are designed for byte input and output.
System.IO.StreamWriter defaults to using an instance of System.Text.UTF8Encoding unless specified otherwise. This instance of System.Text.UTF8Encoding is constructed such that the System.Text.Encoding.GetPreamble method returns the Unicode byte order mark written in UTF-8. The preamble of the encoding is added to a stream when you are not appending to an existing stream. This means any text file you create with System.IO.StreamWriter has three byte order marks at its beginning. UTF-8 handles all Unicode characters correctly and gives consistent results ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access