Last post May 18, 2011 10:22 AM by dotcomsoftware
May 18, 2011 08:50 AM|dotcomsoftware|LINK
An application I am developing has an function which exports a dataset to XML to be able to import it again later. The text in the dataset is in Spanish and contains characters with diacritics (eg. áéíóúñçü).
I am outputting the XML using an XmlWriter in UTF-8 encoding, and have also tried UTF-16 and UTF-32. In each case, the special characters are replaced with a ? so therefore appear corrupted when the dataset is imported again.
How do I output the data so that it is correctly encoded in the Xml and can be imported again, without losing any characters?
May 18, 2011 10:22 AM|dotcomsoftware|LINK
Ok, have found out how. Using the HttpServerUtility.HtmlEncode and HttpServerUtility.HtmlDecode methods on the text data encodes it in a way that preserves the special characters