Hello,
I have to know how to fully encode an url in perl. I temporarily did this with JavaScript, but would like to do it via the script.
Thanks in advance.
XFileSharing Pro - How to fully encode a URL?
Re: How to fully encode a URL?
Hi komi.
Depends on what you mean by encoding/escaping and where the
result will be used.
XFS Pro includes a copy of CGI::Simple, so that's one way to encode a url.
The result is:
Thanks, mrperl.
http://search.cpan.org/dist/CGI-Simple/ ... /Simple.pm
Depends on what you mean by encoding/escaping and where the
result will be used.
XFS Pro includes a copy of CGI::Simple, so that's one way to encode a url.
Code: Select all
use strict;
use diagnostics;
use lib 'Modules'; # customize this for your XFS Pro installation
use CGI::Simple;
my $q = new CGI::Simple;
my $url = 'http://sample.com/file 1.html'; # embedded space
my $encoded = $q->url_encode($url);
print $encoded, "\n";
Code: Select all
http%3A%2F%2Fsample.com%2Ffile+1.html
http://search.cpan.org/dist/CGI-Simple/ ... /Simple.pm