Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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
Replies are listed 'Best First'.
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 browsing the Monastery: (6)
As of 2015-11-29 03:12 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (746 votes), past polls