Encoded URL does not work

yihlamur picture yihlamur · Nov 13, 2011 · Viewed 18k times · Source

I am confused about encoded URLs.

For example, when I write my browser:

stackoverflow.com/questions

I can successfully view the page.

However, when I write:

stackoverflow.com%2Fquestions

I am unable to view.

Since %2F means "/", I want to understand why this does not work properly.

The reason why I want to find out is that I am getting an encoded URL and I don't know how I can decode that URL right after I receive it in order not to have an error page.

Answer

Anne picture Anne · Nov 13, 2011

The / is one of the percent-encoding reserved characters. URLs use percent-encoding reserved characters for defining their syntax. Only when these characters are not used in their special role inside a URL, they need to be encoded.

Percent-encoding reserved characters:

!       *       '       (       )       ;       :       @       &       =       +       $       ,       /       ?       #       [       ]
%21     %2A     %27     %28     %29     %3B     %3A     %40     %26     %3D     %2B     %24     %2C     %2F     %3F     %23     %5B     %5D