URL encoding

Here’s an example of URL encoding from the article Forms and buttons: Sending data to the server:

formtest2.html?message1=Things+%26+stuff&ucannotseeme=boo!&message2=Hello+World

Why URL encoding? Well, firstly, data items in the request is separated by and ampersand “&”. In the above example, the hidden data contains an ampersand. If this wasn’t encoded somehow then how can anyone know where the data item ends? So “&” becomes “%26″ (it’s ASCII value [numeric code representing the character] written in hexadecimal [a number system common on computers which uses 16 digits instead of the 10 digits used in binary])

Spaces are also a bit of a pain. For programmers writing code it’s hard to tell if something’s going wrong because of something which we can’t see. Imagine trying to fix a car engine where the spark plugs are invisible. What a pain. Far better to make them visible, right?

When the server deals with the data it just unencodes everything.

If you search for “url encoder” on google you’ll find plenty of tools like this one.

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Leave a Comment