freelanceprogrammers.org Forum Index » Perl
converting hex codes?
Joined: 14 Oct 1999
Posts: 1
converting hex codes?
Hi,<br>I`ve noticed that Perl CGIs almost always
have the following line:<br>$queryString =~
s/%([0-9A-Fa-f]{2})/pack("c",hex($1))/ge<br>A book I was reading says that this
is to convert
the hex codes. What the hell does that mean and why
do we need to do it? Thank you so much to anyone who
can help. I`m kind of new to Perl but I do understand
the syntax.<br>Thanks,<br>J
Joined: 02 Aug 1999
Posts: 11
converting hex codes?
In a URL there are some special characters. These
can be things like a space, :, @, ... It is important
not to use these characters where they would not be
expected in the URL. Because of this the standard says to
precede them with a % and a hexadecimal representation of
their ascii code. (If you have access to UNIX, do `man
ascii` to see these and what they map to.) Hexadecimal
was chosen because any of the standard one byte
characters can be represented with two
characters.<br><br>Hope that explains it a little better.
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







