How do I decode HTML that was encoded in JS using encodeURIComponent()?

34,432

Solution 1

string s = System.Uri.UnescapeDataString(html);

Solution 2

Think you can use this code.

HttpContext.Current.Server.UrlDecode(html)
Share:
34,432
Nick
Author by

Nick

Software developer in the Boise, Idaho area. Interests: C#, C\C++, Objective-C Client-side scripting Design architecture, Patterns

Updated on July 09, 2022

Comments

  • Nick
    Nick almost 2 years

    I tried :

    string decodedHtml = HttpUtility.HtmlDecode(html);
    

    Where html is the encoded html. It seems that this does not alter the string at all. The html is still encoded.