I want decode URL A
to B
:
A) http:\/\/example.com\/xyz?params=id%2Cexpire\u0026abc=123
B) http://example.com/xyz?params=id,expire&abc=123
This is a sample URL and I look for a general solution not A.Replace("\/", "/")...
Currently I use HttpUtility.UrlDecode(A, Encoding.UTF8)
and other Encodings
but cannot generate URL B
!
You only need this function
This is a basic example I was able to come up with:
This is probably missing a lot depending on the types of URLs you are going to get. It doesn't handle error checking, escaping of literals, like
\\u0026
should be\u0026
. I'd recommend writing a few unit tests around this with various inputs to get started.