On Mon, 29 Oct 2001, P.Agenbag wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Hi , I posted a question earlier today
regarding stripping slashes from variables. The problem arises when we
gather info from a web form and the user input contains quotes ( " or ' )
. When the string is then used at a later stage ( mailed or echoed to
screen) , the quotes all have \" or \' in them, and \ becomes \\. Someone
replied with a method to remove the quotes from the variable, but that is
not what I'm looking for ( The input contains quotes for a reason and
merely removing them will make the result look funny...). I need some
procedure/function to remove the slashes from the string before
mailing/echoing it again. I'm beginning to think that there might be
something wrong with the Perl/perl code that it does this in the first
place???
<<<<<<<<<<<<<<<
Completely wild guess since you haven't provided the code but it looks to
me as if the script itself must be adjusting the string returned by the
form, probably because it would get an error message if tried to do any
operations on it with the quotes unescaped.
I just did a cgi project where I needed to operate on a string returned by
a form that might contain asterisks. I could e-mail that string fine, but
I couldn't use it in pattern matching operations without the script
crashing. So I made of a copy of the string and changed the * to \*. So I
had *string and \*string, \*string2 I did the operations on, and I used
the original for the E-mail.( Took me a 1/2 hour to figure out though.)
So..., just make a copy of the value at the top before the quotes get
escaped. And use that copy for the e-mail.
Like so:
...
if (param("brand")) {
my $brand = param("brand");
chomp $brand;
my $brand2 = param("brand");
chomp $brand; #original string for E-mail
$brand2 =~ s/\*/\\\*/g; # escapes any asterisks like so \*
...
Probably a better way to do this, I'm fairly new. This worked for
me though.
good luck,
Jack Daly
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]