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?
1. The unescape() function is used to decode that string encoded by the escape() function. The escape() function in JavaScript is used for encoding a string.
The unescape function is used in JavaScript to decode a string encoded using the encode function, or to decode other types of encoded strings, such as URLs. For example, the JavaScript below will encode and then decode a string. var jif = "JavaScript is fun!"; var esc_jif = escape(jif); document.
In JavaScript, to decode a string unescape() method is used. This method takes a string, which is encoded by escape() method, and decodes it. The hexadecimal characters in a string will be replaced by the actual characters they represent using unescape() method.
The unescape() function computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.
HttpUtility.UrlDecode
should do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With