Can a URL be double encoded?

1k views Asked by At

A basic encoded URL would usually comprise of a "?" and few "&". Can this url be double encoded to eliminate all "?" and all the "&". would it work? Is it right to do it?

Please check a sample encoded url -

http://www.permadi.com/tutorial/urlEncoding/example.html?var=This+is+a+simple+%26+short+test&testmail=the+master.
1

There are 1 answers

1
Kristian Vitozev On

Use encodeURIComponent, it will produce:

http%3A%2F%2Fwww.permadi.com%2Ftutorial%2FurlEncoding%2Fexample.html%3Fvar%3DThis%20is%20a%20simple%20%26%20short%20test%26testmail%3Dthe%20master.%20

It should works in all major browsers.