Saturday, 26 March 2016

URL encoding

Web addresses can be written using hexadecimal rather than denary. Hexadecimal codes are preceded by a % sign. For example, the word “www.ruknuddin.com” is written as:
r           u          k          n          u          d          d          i           n         
in hex             %72    %75    %6B    %6E    %75    %64    %64    %69    %6E


w
w
w
.
r
u
k
n
u
d
d
i
n
.
c
o
m
%77
%77
%77
%2E
%72
%75
%6B
%6E
%75
%64
%64
%69
%6E
%2E
%63
%6F
%6D

Some characters are not allowed in URL. URL encoding converts characters into a format that can be transmitted over the Internet.
For example
Ø  %20 – is used in URL in place of <space> not allowed in a URL, %20 is the coding for a space (32 in denary)
Ø ? – separates the URL from all parameters or variables
e.g. for query to search inqilab patel in Google
https://www.google.com.pk/search?q=inqilab%20patel
here q is variable for query “?” separates it from URL “https://www.google.com.pk/search”
while“%20”  is used for the space between “inqilab” and “patel” and
to separate   Variable from URL 

 Example Question 2:
Consider the URL:
http://cie.org.uk/computerscience.html
(i) Give the meaning of the following parts of the URL.

http ....................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
cie.org.uk ...........................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
computerscience.html .......................................................................................................
...........................................................................................................................................
....................................................................................................................................... [3]
(ii) Sometimes the URL contains the characters %20 and ?.
Describe the function of these characters.
%20 ...................................................................................................................................
...........................................................................................................................................
? ........................................................................................................................................
...................................................................................................................................... [2]

Characters can be represented in a computer by a numerical code.
The following list shows 16 characters with their numerical codes in denary:
a = 97             d = 100           h = 104           m = 109          t = 116
b = 98             e = 101           i = 105            o = 111           u = 117
c = 99             g = 103           k = 107           r = 114            w = 119
. = 46 (code for the full stop)
Web addresses can be written using hexadecimal rather than denary. Hexadecimal codes are preceded by a % sign. For example, the word “c a g e” is written as:
either              99        97        103     101    (in denary)
or                     %63   %61    %67    %65    (in hexadecimal)
(a) Complete the conversion of the following web address into hexadecimal: [3]
w
w
w
.
c
i
e
.
o
r
g
.
u
K
%77
%77
%77












b) Complete the web address from the given hexadecimal codes: [3]
%77
%77
%77
%2E
%72
%6F
%63
%6B
%69
%63
%74
%2E
%63
%6F
%6D
w
w
w















0 comments:

Post a Comment