I have a web form where I let users post text which I save in a mysql database. I have the following code to strip out the crap in the form. However, this code also strips out paragraph markers. Any idea how I can keep paragraphs, but avoid all the %2estuff+in+it%3E....
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
$i=0;
foreach $pair (@pairs) {
$i++;
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
chomp $value;
$FORM{$name} = $value;
}
Thanks
Todd
todd at mac os x dot com
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
$i=0;
foreach $pair (@pairs) {
$i++;
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
chomp $value;
$FORM{$name} = $value;
}
Thanks
Todd
todd at mac os x dot com