hotshot has asked for the wisdom of the Perl Monks concerning the following question:

hello ! I have a problem reading from browser to my CGI script a parameter that was sent to me in GET method. the specific parameter include the sign '+' in it. I receive this paramete with the value without the '+' sign, for example:

# If I have a parameter dir=/lost+found
# when I read it using: $dir = param('dir');
# I get: $dir == '/lost found';

anyone knows what the hell is going here?

Thanks.

Hotshot

Edit kudra, 2002-05-07 Added missing </I> tag

Replies are listed 'Best First'.
Re: getting parameters from browser
by Zaxo (Archbishop) on May 08, 2002 at 06:58 UTC

    CGI.pm is expecting params to arrive uuencoded per the cgi standard.. The '/lost+found' string will be properly encoded by the browser when it stumbits, but you need to code by hand for local testing. Examples:

    $ perl -MCGI -e'$q=CGI->new;print $q->param(q/dir/),$/' dir='/lost+fou +nd' /lost found $ perl -MCGI -e'$q=CGI->new;print $q->param(q/dir/),$/' dir='/lost%2Bf +ound' /lost+found $
    The first verifies your results, the second shows how to encode.

    After Compline,
    Zaxo

A reply falls below the community's threshold of quality. You may see it by logging in.