How to map URL to %xx?

Discussion in 'Perl Misc' started by Liberal, Dec 12, 2003.

  1. Liberal

    Liberal Guest

    I need to map things like http:// to the %xx code. Change none
    digital/letter to % then the ASCII value in 16.

    It should be a 1 line code.
     
    Liberal, Dec 12, 2003
    #1
    1. Advertising

  2. Liberal

    Tony Curtis Guest

    >> On Fri, 12 Dec 2003 03:14:35 GMT,
    >> "Liberal" <> said:


    > I need to map things like http:// to the %xx code. Change
    > none digital/letter to % then the ASCII value in 16.


    Sounds like you want URI::Escape

    > It should be a 1 line code.


    Homework, eh?
     
    Tony Curtis, Dec 12, 2003
    #2
    1. Advertising

  3. Liberal

    Liberal Guest

    $url =~ s/([^\w.-])/sprintf "%%%02X", ord $1/eg;

    don't understand it and don't care. it works.
     
    Liberal, Dec 12, 2003
    #3
  4. Liberal

    Uri Guttman Guest

    >>>>> "L" == Liberal <> writes:

    > $url =~ s/([^\w.-])/sprintf "%%%02X", ord $1/eg;
    > don't understand it and don't care. it works.


    and you will never understand perl thinking like that. good luck with
    future homework and all those spammers and crackers who will ream your
    homegrown cgi scripts.

    $DIETY save us from twits like you who think they should be allowed to
    code.

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
     
    Uri Guttman, Dec 12, 2003
    #4
  5. Liberal

    Matt Garrish Guest

    "Liberal" <> wrote in message
    news:z3bCb.181886$...
    > $url =~ s/([^\w.-])/sprintf "%%%02X", ord $1/eg;
    >
    > don't understand it and don't care. it works.
    >


    You've joined a long tradition of sloppy programmers with that response. And
    the standard reply is if you don't know what it's doing, how do you know it
    works?

    Matt
     
    Matt Garrish, Dec 12, 2003
    #5
  6. Liberal

    Matija Papec Guest

    On Fri, 12 Dec 2003 04:00:31 GMT, "Liberal" <> wrote:

    >$url =~ s/([^\w.-])/sprintf "%%%02X", ord $1/eg;
    >
    >don't understand it and don't care. it works.


    So, you just wanted to share your thoughts with the world? :)
     
    Matija Papec, Dec 12, 2003
    #6
  7. Matija Papec wrote:
    > On Fri, 12 Dec 2003 04:00:31 GMT, "Liberal" <> wrote:
    >
    >
    >>$url =~ s/([^\w.-])/sprintf "%%%02X", ord $1/eg;
    >>
    >>don't understand it and don't care. it works.

    >
    >
    > So, you just wanted to share your thoughts with the world? :)
    >

    Well, posting the answer to your own question if you find it elsewhere
    is good netiquette; you have to give him credit for that, even if his
    attitude towards understanding the code he uses is horrible.

    Chris Mattern
     
    Chris Mattern, Dec 12, 2003
    #7
  8. >>>>> "Liberal" == Liberal <> writes:

    Liberal> I need to map things like http:// to the %xx code. Change none
    Liberal> digital/letter to % then the ASCII value in 16.

    Well, you don't need to change http://, but perhaps some of the
    things that form a URI later. See the URI module for all the options.

    --
    Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
    <> <URL:http://www.stonehenge.com/merlyn/>
    Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
    See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
     
    Randal L. Schwartz, Dec 12, 2003
    #8
  9. Liberal

    Matija Papec Guest

    X-Ftn-To: Chris Mattern

    Chris Mattern <> wrote:
    >> So, you just wanted to share your thoughts with the world? :)
    >>

    >Well, posting the answer to your own question if you find it elsewhere
    >is good netiquette; you have to give him credit for that, even if his
    >attitude towards understanding the code he uses is horrible.


    Indeed, there is a good reading which covers more aspects of such attitude
    http://www.sampioni.com/en/zasto_sampioni.htm


    --
    Matija
     
    Matija Papec, Dec 13, 2003
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon paugh
    Replies:
    1
    Views:
    882
  2. alex
    Replies:
    1
    Views:
    678
    Lau Lei Cheong
    Feb 4, 2005
  3. Matthias Hildebrand
    Replies:
    5
    Views:
    8,120
    krogers
    Mar 20, 2012
  4. Vlad
    Replies:
    0
    Views:
    383
  5. Just D.
    Replies:
    0
    Views:
    509
    Just D.
    Aug 11, 2004
Loading...

Share This Page