How to map URL to %xx?

L

Liberal

I need to map things like http:// to the %xx code. Change none
digital/letter to % then the ASCII value in 16.

It should be a 1 line code.
 
L

Liberal

$url =~ s/([^\w.-])/sprintf "%%%02X", ord $1/eg;

don't understand it and don't care. it works.
 
U

Uri Guttman

L" == Liberal said:
$url =~ s/([^\w.-])/sprintf "%%%02X", ord $1/eg;
don't understand it and don't care. it works.

and you will never understand perl thinking like that. good luck with
future homework and all those spammers and crackers who will ream your
homegrown cgi scripts.

$DIETY save us from twits like you who think they should be allowed to
code.

uri
 
M

Matt Garrish

Liberal said:
$url =~ s/([^\w.-])/sprintf "%%%02X", ord $1/eg;

don't understand it and don't care. it works.

You've joined a long tradition of sloppy programmers with that response. And
the standard reply is if you don't know what it's doing, how do you know it
works?

Matt
 
M

Matija Papec

$url =~ s/([^\w.-])/sprintf "%%%02X", ord $1/eg;

don't understand it and don't care. it works.

So, you just wanted to share your thoughts with the world? :)
 
C

Chris Mattern

Matija said:
$url =~ s/([^\w.-])/sprintf "%%%02X", ord $1/eg;

don't understand it and don't care. it works.


So, you just wanted to share your thoughts with the world? :)
Well, posting the answer to your own question if you find it elsewhere
is good netiquette; you have to give him credit for that, even if his
attitude towards understanding the code he uses is horrible.

Chris Mattern
 
R

Randal L. Schwartz

Liberal> I need to map things like http:// to the %xx code. Change none
Liberal> digital/letter to % then the ASCII value in 16.

Well, you don't need to change http://, but perhaps some of the
things that form a URI later. See the URI module for all the options.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top