Home C# .NET Xml Serialization - wrong encoding?
Reply: 0

C# .NET Xml Serialization - wrong encoding?

user907
1#
user907 Published in May 23, 2018, 4:40 pm

I am creating new version of old software (written in different language) which must be compatible, and more precisely export and import should work between them.

Old soft XML file in notepad++: original xml

My XML created in C# also in notepad++: new xml

Code to generate this XML:

        XAttribute rootName = new XAttribute("Name", "");
        XElement root = new XElement("Template", rootName);

        root.Add(new XElement("CODE", "JP„"));

        var document = new XDocument(new XDeclaration("1.0", "ISO-8859-1", "yes"), root);
        document.Save("C:\\temp\\Test.xml");

The special character in my xml is encoded incorrect. It makes me dizzy, because it should be in ISO-8859-1 encoding, even notepad++ shows that file has this encoding.

How can I force my XML to treat special characters like the old one?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.301991 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO