Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Forcing %20 using URI?

by PopeFelix (Sexton)
on Sep 13, 2013 at 18:08 UTC ( #1053984=perlquestion: print w/ replies, xml ) Need Help??
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{}); $uri->path(q{/baz/bak}); my %form = ( 'quux' => 'alpha jub jub', ); $uri->query_form(%form); print qq{$uri\n};

Gives me, when I want

Is there a way to get URI to encode spaces in the query string using %20?

Comment on Forcing %20 using URI?
Select or Download Code
Re: Forcing %20 using URI?
by NetWallah (Abbot) on Sep 13, 2013 at 18:47 UTC
    See URI::Encode, whose purpose in life is just this.

                 My goal ... to kill off the slow brain cells that are holding me back from synergizing my knowledge of vertically integrated mobile platforms in local cloud-based content management system datafication.

      Nah, stick with URI::Escape, it comes with URI, but FWIW, + is the same as %20 and has been for over a decade :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1053984]
Approved by toolic
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2015-07-07 16:05 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (91 votes), past polls