the above suggetion is a hack, you should let the writer to output the right encoding, for example, try something like
using System;
using System.Xml;
class TestWriteXml
{
static void Main()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<root><child>1</child><child>2</child></root>");
XmlTextWriter xtw = new XmlTextWriter("myfile.xml",System.Text.Encoding.GetEncoding("GB2312"));
xtw.Formatting = Formatting.Indented;
xtw.WriteStartDocument();
doc.Save(xtw);
//the following is also fine
//xtw.WriteNode(new XmlNodeReader(doc.DocumentElement), true);
xtw.WriteEndDocument();
xtw.Close();
}
}