URL Encode Decode



Free urlencode and urldecode utility by Apna tutorials to url encode a string and/or url decode an url encoded string.

URLs can only be sent over the Internet using the ASCII character-set. Since URLs often contain characters outside the ASCII set, the URL has to be converted into a valid ASCII format. URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits. URLs cannot contain spaces. URL encoding normally replaces a space with a plus (+) sign or with %20.

What is URL Encoding?

When we pass information through a URL, we need to make sure it only uses specific allowed characters like: alphabetic characters, numerals, and a few special characters that have meaning in the URL string. Any other characters should be encoded so that they don't cause problems.

The most commonly encoded character is the space character. You see this character whenever you see a plus sign (+) in a URL. This represents the space character. The plus sign acts as a special character representing a space in a URL. The most common way we'll see this is in a mailto link that includes a subject. If you want the subject to have spaces in it, you can encode them as pluses:
mailto:email?subject=this+is+my+subject

When Should I Encode a URL?

We should always encode any special characters found in a URL. Generally we won't find any special characters in a URL outside their normal context except with form data. Suppose If we submit data to PHP scripts using the GET method, in that case we should encode the data as it will be sent over the URL.


Share & Like

About ApnaTutorials.com

ApnaTutorials.com is for Java, J2ee, Html5 and android developers. All tutorials are well explained and are easy to understand. We have tested every tutorials on our developement environment before posting it in public domain.