CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Solution to hex packing problem...

 



BikerHQ
Deleted

Dec 6, 2000, 2:55 PM

Post #1 of 3 (658 views)
Solution to hex packing problem... Can't Post

Hi peeps,

Just thought I would let you know how I finally resolved my character problem. I wrote this little sub to take care of it when it needed to happen. (although my code is still crappy!)

sub hexchange {
local $inputchars = $_[0];
$inputchars =~ s/%0D%0A/ /g;
$inputchars =~ s/%(..)/pack("c",hex($1))/ge;
return($inputchars);
}


I got it to strip out carriage returns from text boxes and change hex back to character form. not sure if this is the best way to do it, but it works.

Cheers,
BHQ


japhy
Enthusiast

Dec 6, 2000, 3:59 PM

Post #2 of 3 (658 views)
Re: Solution to hex packing problem... [In reply to] Can't Post

You should change %(..) to the more proper %([a-fA-F0-9]{2}). URL escaping is only defined for %HH, where H is a hexadecimal character.

------------------
Jeff "japhy" Pinyan -- accomplished author, consultant, hacker, and teacher



BikerHQ
Deleted

Dec 6, 2000, 4:43 PM

Post #3 of 3 (658 views)
Re: Solution to hex packing problem... [In reply to] Can't Post

Thanks for the info. I plead novice ignorance but am still learning! It's the only excuse there can be!

I've put the guestbook up anywayz. Am happy that my first script is actually gonna be productive!

:)

Feel free to sign it.

http://www.bikerhq.co.uk

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives