PopeFelix has asked for the wisdom of the Perl Monks concerning the following question:
So I want to create a URL using URI, because I like doing that better than I like creating the URL by hand.
#!/usr/bin/perl use strict; use warnings; use English qw/-no_match_vars/; use URI; use URI::QueryParam; my $uri = URI->new(q{http://foo.bar/}); $uri->path(q{/baz/bak}); my %form = ( 'quux' => 'alpha jub jub', ); $uri->query_form(%form); print qq{$uri\n};
Gives me http://foo.bar/baz/bak?quux=alpha+jub+jub, when I want http://foo.bar/baz/bak?quux=alpha%20jub%20jub.
Is there a way to get URI to encode spaces in the query string using %20?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Forcing %20 using URI?
by NetWallah (Canon) on Sep 13, 2013 at 18:47 UTC | |
by Anonymous Monk on Sep 14, 2013 at 01:09 UTC |