in reply to Re: PayPal Advice Sought
in thread PayPal Advice Sought
I have a question about that regex. A look at
sub unescape in CGI reveals a regex
that's nearly identical to the one in question. The first
difference is trivial {2}. I'm curious about how
significant the use of a signed pack (c) in the CGI regex
is, in contrast to the unsigned pack (C) in the other one?
For reference's sake here's sub unescape from CGI.pm version 2.46:$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # carg +o $todecode =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; # CGI
thanks - epoptai# unescape URL-encoded data sub unescape { shift() if ref($_[0]); my $todecode = shift; return undef unless defined($todecode); $todecode =~ tr/+/ /; # pluses become spaces $todecode =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; return $todecode; }
--
Check out my Perlmonks Related Scripts like framechat,
reputer, and xNN.
|
---|
Replies are listed 'Best First'. | |
---|---|
pack 'c',... -vs.- pack 'C',... was: Re: Re: Re: PayPal Advice Sought
by ariels (Curate) on Jul 08, 2001 at 01:07 UTC | |
Re: Re: Re: PayPal Advice Sought
by MeowChow (Vicar) on Jul 08, 2001 at 01:11 UTC | |
by John M. Dlugosz (Monsignor) on Jul 08, 2001 at 02:20 UTC |
In Section
Seekers of Perl Wisdom