Unescape JavaScript的escape()使用C#(Unescape JavaScript's escape() using C#)

编程入门 行业动态 更新时间:2024-10-28 20:31:25
Unescape JavaScript的escape()使用C#(Unescape JavaScript's escape() using C#)

C#中的任何函数处理如JavaScript的转义/取消

我有一个这样的JSON字符串:

{"Feeds":[{"Url":"www.test.com","FeedType":"Twitter"},{"Url":"www.test2.com","FeedType":"Youtube"}]}

在escape()后看起来像这样escape()

%7B%22Feeds%22%3A%5B%7B%22Url%22%3A%22www.test.com%22%2C%22FeedType%22%3A%22Twitter%22%7D%2C%7B%22Url%22%3A%22www.test2.com%22%2C%22FeedType%22%3A%22Youtube%22%7D%5D%7D

在我的C#代码中,我想取消对这个字符串的描述,以便它看起来和escape()之前完全一样,

这可能吗?

Are the any functions in C# that handle escape/unescape like JavaScript?

I have a JSON string like this:

{"Feeds":[{"Url":"www.test.com","FeedType":"Twitter"},{"Url":"www.test2.com","FeedType":"Youtube"}]}

Which looks like this after escape()

%7B%22Feeds%22%3A%5B%7B%22Url%22%3A%22www.test.com%22%2C%22FeedType%22%3A%22Twitter%22%7D%2C%7B%22Url%22%3A%22www.test2.com%22%2C%22FeedType%22%3A%22Youtube%22%7D%5D%7D

In my C# code I would like to unescape this string so that it looks exactly the same as it did before the escape()

Is this possible?

最满意答案

HttpUtility.UrlDecode应该做的伎俩。

HttpUtility.UrlDecode should do the trick.

更多推荐

本文发布于:2023-08-01 17:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1362057.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Unescape   JavaScript   escape

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!