How to proper read XML strings with the letter ø?



I've been using this code to handle the deserialization of XMLs string:



public static object DeserializeFromString(string serializedObject, Type serializedObjectType)
{
TextReader tr = new StringReader(serializedObject);
XmlSerializer serializer = new XmlSerializer(serializedObjectType);
return serializer.Deserialize(tr);
}


Now when I try to run it on a XML like this:



<?xml version="1.0" encoding="UTF-8"?>
<author>
<id type="integer">904719</id>
<name>Jo Nesbø</name>
</author>


The only thing different about this XML is the character on the name of the author. I believe that is the cause to my error: "There is an error in XML document (23, 44)".


What are my possible solutions?


No comments:

Post a Comment