I would like to write Latin accents inside an XML text file with the corresponding ISO code.
For instance é
is replaced by é
on the file.
My issue is my first & is escaped by Xml.Linq.
So the result is &#amp;233;
.
internal void SaveCurrentFile(XElement root)
{
var encoding = Encoding.GetEncoding("ISO-8859-1");
XmlWriterSettings xmlWriterSettings = new XmlWriterSettings
{
Indent = true,
OmitXmlDeclaration = false,
Encoding = encoding
};
using (var writer = XmlWriter.Create(GetFolderPath() + "test.xml", xmlWriterSettings))
{
root.Save(writer);
}
}
I did not see any options in XmlWriterSettings to help me.
Thank you for your help.