开发者

URL Decoding JSON in C#

I have an app that uses ajax (jQ开发者_StackOverflow社区uery) quite extensively and when sending JSON to my web service I always "escape" any strings to make sure there is not any nastiness in there. To decode it at the other end (in my c# code) I have been using HttpUtility.URLDecode() and this has been working a treat until it came to the £ symbol, it just doesn't seem to be able to handle it.

What I want to know is, is this the best way of decoding my strings and how do I go about handling the £ sign?


The problem may be on the escaping side. Use JavaScript's encodeURIComponent(), not the older escape(), which doesn't handle Unicode characters as well.


I had the same problem, the problem was escape().

To retrieve data in C# i use System.Uri.UnescapeDataString()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜