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

LWP and URI escape

by johnnywang (Priest)
on Mar 02, 2007 at 23:05 UTC ( #602977=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use URI::Escape:
    ...
    
    my $res = get("http://www.foo.com?data=".uri_escape("12 34+56")); #sen
    +t as: data=12%2034%2B12, both space and "+" are escaped.
    my $res2 = get("http://www.foo.com?data=12 34+56")); # sent as: date=1
    +2%2034+56, i.e. space is escaped, but "+" is not.
    
  2. or download this
    # in URI::_init(C:/Perl/site/lib/URI.pm:76):
      $str =~ s/([^$uric\#])/$URI::Escape::escapes{$1}/go;
    # where $uric is:
    # \;\/\?\:\@\&\=\+\$\,\[\]A-Za-z0-9\-_\.\!\~\*\'\(\)%
    
  3. or download this
        $text =~ s/([^A-Za-z0-9\-_.!~*'()])/$escapes{$1}/g;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2021-10-18 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (75 votes). Check out past polls.

    Notices?