translating special characters from form elements
[email protected] (allan) Sun, 29 Apr 2001 22:43:08 +0200
| Newsgroups | perl.macperl.webcgi |
|---|---|
| Message-ID | <[email protected]> |
im using the cgi-module, cgi.pm
for some file-uploading purposes.
i also have some html form elements like a textfield:
$my_n_1 = $q->param("textfield");
in this formfield there can be any character.
usually i translate some of these characters with the wellknown routine
like this:
sub readform{
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/</</g;
$value =~ s/>/>/g;
$FORM{$name} = $value;
}
}
__END__
i want to apply a similar routine to lines like the
$my_n_1 = $q->param("textfield");
so my question is: is there a built-in way to do it via cgi.pm or do i
need to make my own function?
thanks
allan