0

Hello!

Is there a way to parse xml content to unicode format?
I'm getting this:

"Minél nagyobb a család, annál nehezebb az újdonsült barátnak-barátnőnek beilleszkedni."

But I'd like this:

"Minél nagyobb a család, annál nehezebb az újdonsült barátnak-barátnőnek beilleszkedni."

I'm using a web service to download an rss feed asynchronously to a WPF datagrid, and I get all the texts in the above format.
What could I do?
I've tried the HttpUtiliy.HtmlDecode(), but did no good at all.

Thanks in advance!

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by sknake
Featured Replies
  • I've question when it loses its format? try to catch the message returned from xml webservice and see if it comes in the right format or not? I just want to put my hand on the phase content loses its format. Read More

2

I've question when it loses its format? try to catch the message returned from xml webservice and see if it comes in the right format or not? I just want to put my hand on the phase content loses its format.

Comments
welcome back!
welcome back
0

Also post the code you are using to fetch the RSS feed. Somewhere along the way you may be missing an opportunity to specify the proper encoding.

0

Thank you or the answers, here is my code:

public class RssData
        {   
            public string title { get; set; }
            public string description { get; set;}
            public string link { get; set; }
            public DateTime pubDate { get; set; }
            public string source { get; set; }
        }
  
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            WebClient cli = new WebClient();
            Uri url = new Uri(linkbox.Text.ToString());
            cli.DownloadStringCompleted += new DownloadStringCompletedEventHandler(cli_DownLoadStringCompleted);
            cli.DownloadStringAsync(url);
        }

        private void cli_DownLoadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
           XDocument xdoc = XDocument.Parse(e.Result,LoadOptions.None);
            
            var rssFeed = from story in xdoc.Descendants("item")
                          select new RssData
                          {
                              title = (story.Element("title").Value.ToString()),
                     
                              description = StripHTML(((string)story.Element("description"))),
                              link = (string)story.Element("link"),
                              pubDate = (DateTime)story.Element("pubDate"),
source=(string)story.Element("link").Parent.Element("title")


                          };
            Array ase= rssFeed.ToArray(); 

            datag.ItemsSource = ase;
        }

SrtipHTML is a string() method which returns a string without the html tags.

Have you got any suggestions about how should I do it?

Edited by konczuras: n/a

0

Oh, I forgot to mention that I've wrote the content to my console like this:

Console.WriteLine(XDocument.Parse(e.Result));

And this isn't good as well. The same strange characters are in it too.

0

Is this RSS feed online? Can you post enough code where we can run this example and see the problem?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.