Is there any function that converts an escaped Url string to its unescaped form? System.Web.HttpUtility.UrlDecode()
can do that job but I don't want to add a reference to System.Web.dll
. Since my app is not a web application, I don't want to add a dependency for only using a function in an assembly.
UPDATE: Check Rick Strahl's blog post about the same issue.
@Smith
I was having the save problem. No changes or just further jumbling.
After testing many things I noticed a test string did decode. Ultimately I had to create a new empty string, set it's value to the encoded string then run
WebUtility.HtmlDecode
andUri.UnescapeDataString
on the new string. For some reason I had to run the decode and unescape in the order I mentioned. Bizarre.I solved it with something like this.