i have the following code:
var doc = new XmlDocument();
XmlDeclaration xmlDeclaration = doc.CreateXmlDeclaration(\"1.0\", \"UTF-8\", null);
doc.AppendChild(
From the MSDN we can see...
The encoding on the TextWriter determines the encoding that is written out (The encoding of the XmlDeclaration node is replaced by the encoding of the TextWriter). If there was no encoding specified on the TextWriter, the XmlDocument is saved without an encoding attribute.
If you want to use the encoding from the XmlDeclaration you'll need to use a stream to save the document.