I have an XML file that is ACII encoded.
I tried reading it using two different versions of Microsoft XmlReader:
XmlReader.Create(new StreamReader(fileImport.FileContent, true));new XmlTextReader(fileImport.FileContent)
The first, XmlReader.Create, which uses StreamReader to encode it, works great.
The second, the new XmlTextReader, throws an XmlException with the message "Invalid character in this encoding."
If you read the MSDN documentation for both of them, they both must determine the encoding from byte bytes, and if that doesn't work, go back to UTF-8.
XmlTextReader [msdn] 
StreamReader [msdn] 
So, why does XmlTextReader not work with invalid encoding, while StreamReader does not do this, when the documentation says both implementations, does it treat encoding the same way by default?
source share