我使用WebUtility.HtmlDecode
去试图解码一个字符串,其中一部分是低于:WebUtility.HtmlDecode无法解码的String
checkin=%7B%22id%22%3A%224f612730e4b071dd72e3749d%22%2C%22createdAt%22%3A1331767088%2C%22type%22%3A%22checkin%22%2C%22timeZone%22%3A%22America%5C%2FDenver%22%2C
但是,WebUtility.HtmlDecode
无法对其进行解码,它的任何。如果它的事项,在这里是怎么了生成的字符串:
public static Dictionary<String, dynamic> DeserializeRequestStream(Stream requestStream, int contentLength)
{
requestStream.Position = 0; //Since a custom route with post data AND an ID passed in a parameter reads this stream. Damn bugs.
var bytes = new byte[contentLength];
requestStream.Read(bytes, 0, contentLength); //(int)requestStream.Length - contentLength
var jsonResponse = System.Text.Encoding.UTF8.GetString(bytes, 0, bytes.Length);
var decodedResponse = WebUtility.HtmlEncode(jsonResponse);
//...snip...
}
推测这是编码的JSON数据,那我从POST请求阅读。我将如何将此字符串解码为常规JSON?
编辑: Lasse V. Karlsen指出,这实际上是URL编码,而且我一直在吠叫错误的树。问题依然存在:我将如何解码?
'%7B'为* URL *编码,而非* HTML *编码。 HTML编码处理和符号等。 – 2012-03-15 00:58:12