What is URL encoding ? known also as Percent-encoding

About

In a URL / Uniform Resource Identifier (URI), you have reserved character that are part of the URL syntax that cannot be used.

For instance:

Percent-encoding, also known as Url Encoding maps (ie encode) :

  • this reserved characters
  • to text that starts with a percent (hence percent encoding)

Example:

Url Encoding Set Illustration

Although it is known as URL encoding it is, in fact, used more generally within the main Uniform Resource Identifier (URI) set, which includes both:

It is also used in the preparation of data of the application/x-www-form-urlencoded media type, as is often used in the submission of HTML form data

Purpose

The purpose detailed is:

  • protecting characters from being interpreted as special/reserved URL delimiters,
  • protecting URLs from being mangled by transmission media with character conversions (like some email systems).

Snippet

let uri = "sftp://hostname\\foo:Pwd#Pwd@host:port";
console.log("The encoded URI is: "+encodeURI(uri));

The # must normaly be encoded as %23

Reserved Character

Character URL Encoding
Reserved
! %21
# %23
$ %24
& %26
' %27
( %28
) %29
* %2A
+ %2B
, %2C
/ %2F
: %3A
; %3B
= %3D
? %3F
@ %40
[ %5B
] %5D
Common characters
newline %0A or %0D or %0D%0A
space %20
" %22
% %25
- %2D
. %2E
< %3C
> %3E
\ %5C
^ %5E
_ %5F
` %60
{ %7B
| %7C
} %7D
~ %7E

1) 2)





Discover More
Boxdim
CSS - Background (Image)

The background of an element is the total size of the element: including padding and border but not the margin. The margin is transparent. When two element overlap, you can send one element to...
Data System Architecture
Character Set - UTF8

utf version 8 bytes. UTF-8 bytes are divided in “waterproof” categories as follows: Bytes 0x00 to 0x7F aresingle bytes, they each represent a single codepoint in the exact same format as in...
HTML Form - 1001 ways to submit a Form and handle the corresponding Event

This page talks and shows all the ways on how to submit a form and handle the submit event in javascript. How a form can be submitted ? HTML One way is to include a input element of type submit that...
Jdbc Class Architecture
Jdbc - URL (and Driver Class)

URL JDBC is using URL to locate the database schema. Database URLs are strings that you specify for the value of the url property of the DataSource object. URL userNameuserPasswordencoded URL...
Media Type - x-www-form-urlencoded

application/x-www-form-urlencoded is a media type. This type is set in the enctype attribute of a HTML form submission and is found in the body of the resulting HTTP request. URL...
Card Puncher Data Processing
Php - URL

in php in php You parse it in two steps: first the string format of the query part with parse_url then you put the key/argument of the query in an array with parse_str. URL encoded then...
URI - Fragment (Ref, Reference)

The fragment is the last part of a URI An URI has the following syntax with the #fragment being the fragment The value of the fragment must be encoded. The fragment will cause the browser to scroll...
URL - Query String

A query string is the fourth part of a URI. An URI has the following syntax with the ?query being the query string and within it, the query string follows this syntax The value of the parameter must...



Share this page:
Follow us:
Task Runner