request.ContentType = "application/json; charset=utf-8";

 

这种的postdata 在写入 Stream的时候要确保编码是  utf-8

 

                string postData = "中文乱码问题";
                UTF8Encoding encoding = new UTF8Encoding();
                byte[] bytepostData = encoding.GetBytes(postData);
                request.ContentLength = bytepostData.Length;
                //发送数据 using结束代码段释放
                using (Stream requestStm = request.GetRequestStream())
                {
                    requestStm.Write(bytepostData, 0, bytepostData.Length);
                }

  

相关文章: