Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: When constructing a URL from script variables, how do I handle spaces properly?

by merlyn (Sage)
on Apr 30, 2000 at 16:01 UTC ( [id://9737]=note: print w/replies, xml ) Need Help??


in reply to When constructing a URL from script variables, how do I handle spaces properly?

In fact, if you are trying to construct
<a href="/cgi-bin/editmarine.pl?marine=$marineid">edit marine</a>
You'll run into a lot of problems if $marine is not URI-encoded. So the first step is to trot over to URI::Escape and run it through there. No spaces will be left!

Editor's note:

#Sample Code my $SafeMarine = URI::Escape::uri_escape($marineid); <a href="/cgi-bin/editmarine.pl?marine=$SafeMarine">edit marine</a>

Replies are listed 'Best First'.
RE: Answer: When constructing a URL from script variables, how do I handle spaces properly?
by steveAZ98 (Monk) on Jul 25, 2000 at 06:08 UTC
    I've also used the code below to replace spaces with the correct chars.
    $value =~ s/\s/\%20/g;
    And it seems to work good for my purposes.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://9737]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 16:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found