michael watson (IAH-C) wrote:
> Hi guys
>
> Hope someone can help.
>
> My file is called lame#19.gpr
>
> I am trying to send this to my cgi script, so my url looks like:
>
> ....cgi?filename=lame#19.gpr
>
> But of course "#" is a special character for a URL, so my
> filename parameter gets cut short to lame....
>
> Does anyone know of a nice, elegant or simply workable way of
> getting round this, saving renaming the file?
You should *always* properly escape parameter values. You can use
URI::Escape module for escaping parameter values individually, or you can
use the URI module to construct a properly escaped URI.
URI module example:
use URI;
my $uri = URI->new('http://myhost.com/cgi/myscript.cgi');
$uri->query_form(filename => 'lame#19.gpr');
print "$uri\n";
prints:
http://myhost.com/cgi/myscript.cgi?filename=lame%2319.gpr
If you're using the CGI module and constructing a self-referencing URL, the
url() method automatically escapes the parameter values (which you set with
param()).
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]