Skip to content

How to convert uri response of text/html chartset:iso-8859-1

Rightthen

Asked Oct 18, 2017, 12:09 PM EDT2 answers
Share
LinkedInX
How can one convert the response recieved from Uri through WebClient into a human readable string. 
I have tried.   
  1.  System.Text.Encoding
  2. Convert.ToBase64String, Convert.FromBase64String
doesnot work as desired. it is either gibberish or empty string.
 
Thanks
Regards 

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    You need to use webClient With Header properties.
     
    Java
    WebClient wc = new WebClient();
    wc.Headers.Add("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12");
    wc.Headers.Add("Accept", "*/*");
    wc.Headers.Add("Accept-Language", "en-gb,en;q=0.5");
    wc.Headers.Add("Accept-Charset", "iso-8859-1,utf-8;q=0.7,*;q=0.7"); // add charset
    urlData = wc.DownloadString(uri);
    0
  • 0
    Thanks siddhartha sharna
     
    Allready tried that, before posting question. now doing it through a library.
     
    Thanks
    Regards 
    0