标签:
原文: C#中WebClient中文乱码的解决办法
第一次尝试:
string question = textBox1.Text.ToString(); WebClient youdao = new WebClient(); youdao.Encoding = System.Text.Encoding.GetEncoding("GB2312"); Uri uri = new Uri("http://xxxxxxxxxxxxxx"); textBox1.Text =youdao.DownloadString(uri);
尝试n次后,解决办法如下:
string question = textBox1.Text.ToString(); WebClient youdao = new WebClient(); youdao.Encoding = System.Text.Encoding.GetEncoding("GB2312"); Uri uri = new Uri("http://xxxxxxxxxxxxxx"); textBox1.Text =Encoding.UTF8.GetString(youdao.DownloadData(uri));
标签:
原文地址:http://www.cnblogs.com/lonelyxmas/p/4697234.html