编码来自httpClient.PostAsync的响应

时间:2015-01-18 18:22:17

标签: c# post encoding windows-phone-8.1

我的服务器响应编码存在问题。

我从我的Android客户端以及我的Windows手机客户端发送此字符串:

{"debug":"false","action":"test","option":{"0":"È","1":"è"}}

在android客户端中我看到了这个回复

 [{"id_option":73,"description":"\u00e8"},{"id_option":74,"description":"\u00c8"}]

这没关系,但在Windows Phone客户端中我收到了这个回复:

[{"id_option":75,"description":"\u00c3\u0088"},{"id_option":76,"description":"\u00c3\u00a8"}]

服务器是一样的。

Windows Phone通信部分如下:

    var obj = new JsonObject();
            obj.Add("debug", JsonValue.CreateStringValue("false"));
            obj.Add("action", JsonValue.CreateStringValue("test"));
            obj.Add("option", optionJson);   
 var values = new List<KeyValuePair<string, string>>
                                {
                                    new KeyValuePair<string, string>("values", obj.Stringify()),                  
                                };
                HttpResponseMessage response = await httpClient.PostAsync(urlPath, new FormUrlEncodedContent(values));
                response.EnsureSuccessStatusCode();
                var responseString = await response.Content.ReadAsStringAsync();
                Debug.WriteLine(responseString);

0 个答案:

没有答案