INTRODUCTION TO URL ENCODING
http://www.permadi.com/tutorial/urlEncoding/
URL Encoding Background URL Encoding is the process of converting string into valid URL format. Valid URL format means that the URL contains only what is termed "alpha | digit | safe | extra | escape" characters. You can read more about the what and the whys of these terms on the World Wide Web Consortium site: http://www.w3.org/Addressing/URL/url-spec.html andhttp://www.w3.org/International/francois.yergeau.html. URL encoding is normally performed to convert data passed via html forms, because such data may contain special character, such as "/", ".", "#", and so on, which could either: a) have special meanings; or b) is not a valid character for an URL; or c) could be altered during transfer. For instance, the "#" character needs to be encoded because it has a special meaning of that of an html anchor. The <space> character also needs to be encoded because is not allowed on a valid URL format. Also, some characters, such as "~" might not transport properly across the internet. Example As an example, click the form below to see the string being URL encoded.
This sample <form> sends the data in the text field using the GET method, which means that the data will be appended as query string. If you click the button and look at the resulting URL in the browser address bar, you should see something like this (the query string portion, which is automatically URL encoded by the browser, is shown in blue):
Here, you can see that:
<space> character and & character are just some of the special characters that need to be encoded. Below are some others (click the button to see the result of the encoding).
Here's the query string portion, which (as before) has been encoded by the browser automatically:
As you can see, when a character is URL-encoded, it's converted as %XY, where X and Y is a number. You will see later where these numbers come from. What Should be URL Encoded? Some Common Special Characters
Note that because the <space> character is very commonly used, a special code ( the "+" sign) has been reserved as its URL encoding. Thus the string "A B" can be URL encoded as either "A%20B" or "A+B".
Where Does the Numbers Come From? Language Support
|