0
在我的Windows Phone應用程序中,我從Internet獲取RSS並解析XML。 我從rss中取出標題和描述,並將它們顯示在TextBlock中。C#在TextBlock中顯示特殊字符
在這裏我發現一些問題,特殊字符被菱形代替包含「?」。
/*CONNECTION AND DOWNLOAD RSS*/ WebClient wc = new WebClient(); wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(load_web_news); wc.DownloadStringAsync(new Uri("http://.../rssFeedNews.asp")); .... /*SAVE RSS*/ TextBlock tbTitle = new TextBlock(); Run rTitle = new Run(); rTitle.Text = rss.Title; Run rDescription = new Run(); rDescription.Text = rss.Description; tbTitle.Inlines.Add(rTitle); .... /*PARSING*/ private void load_web_news(object sender, DownloadStringCompletedEventArgs e) { XElement xmlitems = XElement.Parse(e.Result); List<XElement> elements = xmlitems.Descendants("item").ToList(); foreach (XElement rssItem in elements) { RSSItem rss = new RSSItem(); rss.Description1 = rssItem.Element("description").Value; String title = rssItem.Element("title").Value;
如何在Windows手機應用程序顯示例如特殊字符 「A」 「E」 「°」 等...?
意大利語言精確編碼是 :wc.Encoding = System.Text.Encoding.GetEncoding( 「ISO-8859-1」); –