1

I develop a website data fetcher application using Webclient. it's works frine. but i

facing big problem, about the accented vowels. I mean when i download the string

contains accented vowvels it's not showing properly in the application.

Please see my code

public string DownloadByWebClient(string url)
    {
        string html = string.Empty;
        try
        {
            using (WebClient client = new WebClient())
            {
                try
                {
                    client.Headers.Add("User-Agent", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)");
                    html = client.DownloadString(url);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return "";
                }
                finally
                {
                    client.Dispose();
                }
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
            return "";
        }
        return "";
    }

Please see my images below.

In web page.

enter image description here

In application

enter image description here

I am clueless. Please help.

Ragesh P Raju
  • 3,879
  • 14
  • 101
  • 136
  • 2
    This happens when unicode characters are read as an 8-bit encoding. – MortenSickel Dec 20 '12 at 07:45
  • 1
    Thank you for your valueable reply. How can i solve it. – Ragesh P Raju Dec 20 '12 at 07:47
  • 1
    Sorry, it is difficult to give spesific feedback on this. You must check out the various steps that are handling the strings. (Been there, done it, no fun... :- ( ) Don't know what it is like with C#, but in php I have to make sure that the script that serves the text is saved as UTF-8. ... – MortenSickel Dec 20 '12 at 07:50
  • try this link http://stackoverflow.com/questions/7137165/webclient-downloadstring-results-in-mangled-characters-due-to-encoding-issues-b it's same in your issue, everything will be fine :) –  Dec 20 '12 at 09:09

0 Answers0