See TextWriter.Synchronized for a thread-safe wrapper. UTF-8 handles all Unicode characters correctly and gives consistent results on localized versions of the operating system.īy default, a StreamWriter is not thread safe. This means any text file you create with StreamWriter will have three byte order marks at its beginning. The preamble of the encoding is added to a stream when you are not appending to an existing stream. This instance of UTF8Encoding is constructed such that the Encoding.GetPreamble method returns the Unicode byte order mark written in UTF-8. StreamWriter defaults to using an instance of UTF8Encoding unless specified otherwise. Remarks StreamWriter is designed for character output in a particular Encoding, whereas classes derived from Stream are designed for byte input and output. ![]() ![]() Summary Implements a TextWriter for writing characters to a stream in a particular encoding. Type: System.IO.StreamWriter System.IO.StreamWriter Class Assembly: Mscorlib.dll
0 Comments
Leave a Reply. |