in reply to Encode a string to be suitable for a URL

The sub is good except that it does not work properly for all characters, I suggest the flw lines instead.

If any body find a mistake in flw code, pls mail to mouradselim@yahoo.com ,I am just a beginner. Thanks.

$data="this is a test&for=many[of]non_alpha)numeric(charracters*"; $_=$data; foreach (split //,$_){ if ($_ eq " ") { $out.="+"; next; } if((ord($_) >= 0x41 && ord($_) <= 0x5a) || (ord($_) >= 0x61 && ord($_) <= 0x7a) || (ord($_) >= 0x30 && ord($_) <= 0x39)) { $out.=$_ ; } else { $out.=sprintf("%%%02X",ord($_)); } } print "$out";

Edit kudra, 2002-02-23 Added code tags