我使用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