Quantcast
Channel: Non-unicode XML representation - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Richard Nienaber for Non-unicode XML representation

$
0
0

Okay I tested it with the following code:

 string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><xml><value>受</value></xml>"; XmlWriterSettings settings = new XmlWriterSettings { Encoding = Encoding.Default }; MemoryStream ms = new MemoryStream(); using (XmlWriter writer = XmlTextWriter.Create(ms, settings))      XElement.Parse(xml).WriteTo(writer); string value = Encoding.Default.GetString(ms.ToArray());

And it correctly escaped the unicode character thus:

<?xml version="1.0" encoding="Windows-1252"?><xml><value>&#x53D7;</value></xml>

I must be doing something wrong somewhere else. Thanks for the help.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>