Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Re: CGI fails to urlencode & chars in outbound url's

by projekt21 (Friar)
on Jun 12, 2002 at 15:39 UTC ( #173874=note: print w/replies, xml ) Need Help??


in reply to Re: Re: CGI fails to urlencode & chars in outbound url's
in thread CGI fails to urlencode & chars in outbound url's

CGI::escape comes from CGI::Util and is not documented (the code is the documentation :-). It is used within CGI.pm and is usable outside, too.

#### from CGI/Util.pm sub escape { shift() if ref($_[0]) || (defined $_[1] && $_[0] eq $CGI::DefaultCla +ss); my $toencode = shift; return undef unless defined($toencode); $EBCDIC = "\t" ne "\011"; if ($EBCDIC) { $toencode=~s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",$E2A[ord($1)] +)/eg; } else { $toencode=~s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg; } return $toencode; }

For more info see Dump a directory as links from CGI.

escapeHTML is fine to produce HTML, but not useful for URIs (your "&" is the best example). If we have an unescaped "&" then this is a parameter delimiter.

alex pleiner <alex@zeitform.de>
zeitform Internet Dienste

Replies are listed 'Best First'.
Re: Re: Re: Re: CGI fails to urlencode & chars in outbound url's
by BrowserUk (Pope) on Jun 12, 2002 at 17:01 UTC

    Thankyou! for (1..1000000);

    Thankyou at two levels.

    1) For taking the time to follow this up for me, and for the Dump-a-dir link. I really wish I had read this a week ago!!

    2) For making me feel sane again. The very fact that someone of merlyn's stature says:

    Getting the HTML and URI escaping right for creating links and labels is fun, not!

    ...makes feel better, cos it has taken me a week and the assistance of many good folks here to get this to work. I was really beginning to beleive that I was thick (which I may still be, but this isn't proof!:).

    I guess that it was bad luck to pick this as my first try at Perl! Still hopefully I've learned stuff that I might not otherwise have done.

Re^4: CGI fails to urlencode & chars in outbound url's
by Anonymous Monk on Aug 01, 2005 at 13:10 UTC
    $EBCDIC = "\t" ne "\011";
    Could someone explain this snippet of a snippet ? I've tried guessing using my limited knowledge of operator precedence.
    I think i'm missing something obvious !

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2021-04-14 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?