【发布时间】:2013-10-09 22:47:28
【问题描述】:
在我的 Windows Phone 应用程序中,我从 Internet 获取 RSS 并解析 XML。 我从 rss 中取出 Title 和 Description,并将它们显示在 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 手机应用中显示特殊字符,例如“à”“è”“°”等?
【问题讨论】:
-
意大利语的精确编码是:wc.Encoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
标签: c# windows-phone-7 windows-phone-8 windows-phone