Reputation: 119
I am downloading an XML-File via WebClient like this:
WebClient connect = new WebClient();
connect.DownloadStringCompleted += new DownloadStringCompletedEventHandler(connect_DownloadStringCompleted);
connect.DownloadStringAsync(new Uri("http://conn.info/api/v8/search/item_short.xml?apikey=123&lang=de&q="+textBox1.Text));
Then I parse them
XElement erg = XElement.Parse(e.Result);
but the problem is, that German letters like "ü" or "ä" won't be displayed properly. Instead, I get a "?" for each of these letters in my output (on a windows phone device).
How is this solvable?
Upvotes: 0
Views: 1396
Reputation: 1088
I assume here that the encoding of your XML is ISO-8859-1. (I cannot access the domain you have above in your code). Try to set the encoding as follows:
connect.Encoding = Encoding.GetEncoding("ISO-8859-1");
I tested a piece of code with http://www.spiegel.de/thema/windows_phone_8/index.rss and it works for me. Please find a screenshot of the results. I circled for you the words with the special characters from the German language.
Upvotes: 0
Reputation: 3212
Well, you already noted that umlauts are missing. I would suggest setting your WebClient to UTF8 mode:
connect.Encoding = System.Text.Encoding.UTF8;
Upvotes: 1