
URL encoding is mostly used in HTML form data submission via HTTP GET requests. Therefore, URL encoding replaces spaces with a plus " +" sign or with " %20" depending on the encoding method.įor instance, if you type any URL with some spaces in the browser address bar and hit enter, immediately that URL will be automatically converted to replace the space with " %20". These hexadecimal digits represent the numerical value of the characters being replaced.

URL encoding replaces the non-ASCII characters with a percent character "%" followed by two hexadecimal digits. URL encoding is a mechanism for translating/converting non-ASCII (unprintable or special) characters to a universally accepted format by web servers and browsers, and that can be transmitted over the Internet. semicolon, equal sign, space, etc), the URL has to be converted into a valid ASCII format. Since oftentimes URLs contain non-ASCII characters (eg. URLs can only be sent over the Internet using the ASCII character-set. For example, the default character set for HTML 4.01 is ISO-8859-1 while the default in HTML5 is UTF-8, which are both built on ASCII. The character sets (encoding) used in modern computers, in HTML, and on the Internet, are all based on ASCII character set.

These characters include the numbers from 0 to 9, the upper and lower case alphabets from A to Z, and some special characters. It was designed in the 1960s, containing 128 characters.

#Decode uri in php how to#
In this article, we will cover what URL encoding and decoding are, where they are applicable and why, and how to do it using PHP language.ĪSCII (American Standard Code for Information Interchange) was the first character encoding standard used between computers and other electronic devices on the Internet. John Mwaniki / How to do URL encoding and decoding in PHP
