Be careful with encodings if you're going to be writing this to a stream; .NET's characters and strings are UTF-16 encoded, so that will actually be written as 001C
(or 1C00
, depending on endianness; I don't remember which). You can avoid this problem by specifying the appropriate encoding when opening the stream.
Edit: Actually, this isn't the case! Having just tested it, the default behaviour for StreamWriter
et al is to use the system's current ANSI code page (usually ISO-8859-1), so it does in fact get written in the expected 8-bit format. This will, of course, give unexpected results for non-ANSI characters.