Character Encoding in $_GET Method

By Sergey Skudaev

+++++

I passed in GET method the string '%Cables' and it was displayed as a special character and not as '%Cables'. Then I tried all the rest characters with % to see what I get
click "Click here" link below.


'%A'
'%B'
'%D'
and so on...
'%Aa'
'%Ba'
'%Da'
and so on...
'%Ab'
'%Bb'
'%Db'
and so on...

% with one character is passed without changes:

% with 2 characters where the second is a is passed with changes. htmlspecialchars does not help!

% with 2 characters where the second is b is passed with changes:


Click here

On this page I use charset=iso-8859-1. How do you explain that?


ASCII for ord(%)=37
ASCII for ord(A)=65
ASCII for ord(a)=97
ASCII for ord(getaa)=37
ASCII for ord(%Aa)=37
Char for chr(170)= ª and it is what we get from GET method when passing %Aa.
35 + 67 + 97=199 and not 170
Char for chr(199)=Ç
Why ASCII for ord(Array(%Aa))=170 and not 199?

















Please rate the tutorial

1 2 3 4 5 6 7 8 9 10



Learn SQL Programming By Examples [Kindle Edition]2.99

Learn PHP Programming by Examples [Kindle Edition] $2.99

Learn Visual Basic 6.0 [Kindle Edition] $1.99

How to Build Your Own Web Site from Scratch [Kindle Edition] $1.49

New-trip.com website source code

Comments
 
Register to add comments ( 1000 char ) for get.php.