Link to home
Start Free TrialLog in
Avatar of Dean Meyer
Dean Meyer

asked on

How to get the web content with different encodings

I have this list of links (adList.Link) where the charset is either shift_jis or UTF-8. If I set the WebClient's encoding to UTF-8, the Japanese Characters are encrypted to those sites that has shift_jis as charsets and if I set it to shift_jis then the UTF-8's sites' japanese characters are then encrypted.


var address = adList.Link;

using (var w = new WebClient())
{
  w.Encoding = Encoding.GetEncoding("shift_jis");
  var json_data = w.DownloadString(address);
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of BigRat
BigRat
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dean Meyer
Dean Meyer

ASKER

Thanks man. What you said works.