我有一个来自 webservive 的 JSON 字符串结果(波斯语)。
但是web服务的结果是这样的:
“\u0622\u062f\u0631\u0633\u0627\u06cc\u0645\u06cc\u0644”
而原文是这样的:
عملیات انجام شد
如何从unicode转换为原始格式C#
这是我的代码
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://webserver.com/");
request.Method = "GET";
request.ContentLength = 0;
request.Credentials = CredentialCache.DefaultCredentials;
request.ContentType = "application/xml";
request.Accept = "application/xml";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (Stream receiveStream = response.GetResponseStream())
{
using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
{
string strContent = readStream.ReadToEnd();
}
}
}
相关分类