XmlWriter, Strings and Byte Order Marks
Posted by: Rick Strahls WebLog,
on 04 Feb 2007 |
View original
UTF-8 with an XmlWriter (or even HtmlTextWriter for that matter) can sometimes be tricky if youre sending output back into anything but a file. If you write data to a string or data to a stream that gets immediately fed into an output stream in a Web application or a POST buffer for an HTTP request you might find that the formatting of the XML generated usually will blow up.
Typically you have code like this:
MemoryStream ms = new MemoryStream();
...