Re: XML encoding issue
1. The documentation of the StringWriter.Encoding gives you the answer for the changed encoding.

Originally Posted by
MSDN
This property is necessary for some XML scenarios where a header must be written containing the encoding used by the StringWriter. This allows the XML code to consume an arbitrary StringWriter and generate the correct XML header.
2. You can solve it by using a XmlWriter.
Code:
// Save to the XML file
MemoryStream stream = new MemoryStream();
XmlTextWriter writer = new XmlTextWriter(stream, Encoding.UTF8);
xmlDoc.Save(writer);
writer.Close();
string content = Encoding.UTF8.GetString(stream.ToArray());
3. The need of changing the encoding of a XML file is depending on the application which wants to read the file. A common scenario is you are writing the file in a .NET application and send it to a server. There is a PERL script located which are trying to parse your file.
Useful or not? Rate my posting. Thanks.