首页 > 代码库 > 把XML保存为ANSI编码

把XML保存为ANSI编码

   XmlDocument xmlDoc = new XmlDocument();                xmlDoc.LoadXml(xmlText);            //plu.xml 编码是ANSI的。否则称上品名是乱码                XmlElement xeRoot = xmlDoc.DocumentElement;                XmlDeclaration xdl = xmlDoc.CreateXmlDeclaration("1.0", "gb2312", "yes");                xmlDoc.InsertBefore(xdl, xeRoot);                xmlDoc.Save(fileFullName);  

 

把XML保存为ANSI编码