I receive an XML file with encoding "ISO-8859-1" (Latin-1)
Within the file (among other tags) I have <OtherText>Example "content" And ─</OtherText>
Now for some reason when I load this into XMLTextReader and do a "XmlReader.Value" to return the value, it returns: "content" And ─
This then, when confronted with a database only accepting Latin-1 encoding, obviously errors.
I have tried the following:
- Converting into bytes and using Encoding.Convert to change from UTF-8 into Latin-1 (which successfully gives me a bunch of "?" instead)
- Using StreamReader(file,Encoding.whatever) to load the file into XmlTextReader
And several variations there-of and different methods on the internet and on StackOverflow istelf.
I understand that .NET strings are UTF-16, but what I don't understand is why, a fully Latin-1 formatted XML file with CORRECT markup for when UTF-8 characters exist which is compatible with older databases AND the web (for HTML markup etc) that it simply overrides that and output's the UTF-8 encoded string ANYWAY.
Is there noway to get around this other than writing my own custom text parser???