I have this code for looping reports in a XML file:
Dim xmlr As XDocument = XDocument.Load("Myfile.xml")
For Each report As XElement In xmlr.Descendants("Report")
'Do stuff with report values
Next
this works, but i get an error if the file contains chars like ÅÄÖ. The xml document has the encoding UFT-8;
<?xml version="1.0" encoding="utf-8"?>
I found this post here, and tried with this code instead, but it does not help;
Dim xmlr As XDocument
Using oReader As StreamReader = New StreamReader("Myfile.xml", Encoding.GetEncoding("UTF-8"))
xmlr = XDocument.Load(oReader)
End Using
Any suggestions?