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

Re: encoding URL ampersands?

by ikegami (Pope)
on Jul 29, 2010 at 20:16 UTC ( #852000=note: print w/ replies, xml ) Need Help??


in reply to encoding URL ampersands?

& => & is part of HTML and XML's escaping scheme. URIs use a different escape mechanism. URI::Escape provides it.

my $url_param = 'http://www.whatzit.com?a=1&b=2'; my $url = "http:/www.xyzzy.com?url=" . uri_escape($url_param);

If you are placing the constructed URL in HTML or XML, you will also need to HTML-escape the constructed URL as a whole.

[ Wrote this much earlier, but forgot to actually post it. Sorry if it's redundant ]


Comment on Re: encoding URL ampersands?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2015-07-04 23:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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









    Results (60 votes), past polls