perl urlencode without libs
$url = "Foo bar com.dx?q=23";
$url =~ s/([^\w\-\.\@])/$1 eq " "?"+":
sprintf("%%%2.2x",ord($1))/eg;
print $url;
I don't remember where I got this, but it must have come in handy for me at some point. Never hurts to have this kind of stuff laying around, just in case.

0 comments:
Post a Comment