解决下载的网页内容乱码问题

var uri =

                    new Uri(

                        "http://z.soso.com/index.php?sort=weibohtml&w=%B7%C0%B7%F8%C9%E4&na=946656000&time=946656000&flag=1&allnum=566&qqnum=856&sohunum=0&sorttype=1");

                //var browser1 = new ScrapingBrowser();

                //var html1 = browser1.DownloadString(uri);

                //WebClient webClient = new WebClient();

                File.WriteAllText("1.html", new WebClient().DownloadString(uri), System.Text.Encoding.GetEncoding("gb2312"));

                String html1 = File.ReadAllText("1.html", System.Text.Encoding.GetEncoding("gb2312"));

 

你可能感兴趣的:(乱码)