I am trying to download this webpage using C# WebClient.. Now it works perfectly with python urllib2 but with c# web client it gives these strange characters in the output file..
I have tried using Encoding with webclient class as well but it doesn't work at all..
public static string GetWebURL()
{
string url = "http://bet.hkjc.com";
WebClient webClient = new WebClient();
webClient.Encoding = Encoding.UTF8;
string html = webClient.DownloadString(url);
File.WriteAllText("page.html", html);
}
this is the output with those strange characters
a€1?¢?¥?2Qt?±wa€°pU?°?±?μQu?2?±tVP?’???—7v?–?—w q?H???¨*a€?%?|ga€“d?|?§%?|?¨?????o)???±r?(N.??,(Q(??,H?μU*I?-(?‘?J,Ka€???*??q)((a€U*T?’ea€°E ??ya€°I9?????‰?‰???…?…???1y%E?19 ??ia€°9?…???– %a?¢i Xa€h"(?‰-P?°U(???K?‰/?—???‰ON?1H/?£(5M?ˉ??4?????¤H??SlHu?°kP??kP?????£?ˉ+PP/La€????4&?μ???MCI_IS??+%?713?/17?¨ ?‰??fd!?? zJ????a€ P??S?2a€?KsS?3J?′ &MA V?¨??K?2?′a€?RKa€?s2??? a???a?′2a€1}?2?“?3?3445?????=?-Wa€Z?a€????“ t|zj^jQbN<??1za€°?…??9a€°y??????yJ_?P-???”???“ch??e?|a€? ?μH&[?—r???¨Ca€?a??0?J%? a€? ?·a€?????P9Ud?|M???”???????–M?—???25?2 ?·?′?3V?·a€ (??M-JOM
What should I do to see the html that is being send?
See Question&Answers more detail:os