日期:2014-05-20  浏览次数:20952 次

UploadValues乱码
C# code


            WebClient WClient = new WebClient();
            System.Collections.Specialized.NameValueCollection VarPost = new System.Collections.Specialized.NameValueCollection();
            WClient.Encoding = System.Text.Encoding.GetEncoding("GB2312");
            VarPost.Add("test", "4");
            VarPost.Add("webname", "我的网站");//此处乱码
            byte[] RemoteByte = WClient.UploadValues(string.Format("http://{0}/install/index.php", SModel.SiteUrl), "POST", VarPost);



//提交上去的中文乱码,哪位朋友知道怎么解决

------解决方案--------------------
试试
VarPost.Add("webname", Encoding.GetString(Encoding.GetEncoding("GB2312").GetBytes("我的网站")));