Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

About "How do I decode or create those %-encodings on the web?"

1 view
Skip to first unread message

Peter Valdemar Mørch

unread,
Jun 23, 2010, 6:59:28 AM6/23/10
to perlfaq...@perl.org
perlfaq9 has the above question, and the answer begins:
> If you are writing a CGI script, you should be using the CGI.pm module
> that comes with perl, or some other equivalent module.

And yes, CGI imports escape and unescape from CGI::Utils but perldoc
CGI::Utils says:
> DESCRIPTION: no public subroutines

So I guess using CGI::escape and CGI::unescape amounts to using
undocumented features of CGI.

In light of that, I suggest the answer to the FAQ to be misleading. At
least I have no idea how to "decode or create those %-encodings on the
web" from reading perldoc CGI.

I suggest one of:
* Document escape and unescape in perldoc CGI (please, please,
please!)
* Elaborate on how this escaping and unescaping can be achieved using
only the documented interface

In any event, I find the FAQ answer is not currently useful as far as
CGI goes.

Peter

brian d foy

unread,
Jun 26, 2010, 10:27:36 PM6/26/10
to perlfaq...@perl.org, Peter Valdemar M�rch
[[ This message was both posted and mailed: see
the "To," "Cc," and "Newsgroups" headers for details. ]]

In article
<f6bd282d-ddd2-4709...@j4g2000yqh.googlegroups.com>,


Peter Valdemar M�rch <4ux6...@sneakemail.com> wrote:


> I suggest one of:
> * Document escape and unescape in perldoc CGI (please, please,
> please!)
> * Elaborate on how this escaping and unescaping can be achieved using
> only the documented interface

Patches welcome :)

Peter Valdemar Mørch

unread,
Jun 28, 2010, 4:57:31 AM6/28/10
to perlfaq...@perl.org
On Jun 27, 4:27 am, brian.d....@gmail.com (brian d foy) wrote:
> Patches welcome :)


CC: Lincoln D. Stein, author of CGI.pm

Yeah, as soon as I hit "Send" I realized that was a very probable
repsonse :-) Ok, so here goes. Also available at http://pastebin.com/bPRq0Nsj
in case Google Groups mangles or does line wrapping:

--- orig.CGI.pm 2010-01-29 15:41:54.000000000 +0100
+++ CGI.pm 2010-06-28 08:56:49.000000000 +0200
@@ -255,6 +255,7 @@
':html' => [qw/:html2 :html3 :html4 :netscape/],
':standard' => [qw/:html2 :html3 :html4 :form :cgi/],
':push' => [qw/multipart_init multipart_start multipart_end
multipart_final/],
+ ':escape' => [qw/escape unescape/],
':all' =>
[qw/:html2 :html3 :netscape :form :cgi :internal :html4/]
);

@@ -4878,6 +4879,10 @@

Import all HTML-generating shortcuts (i.e. 'html2', 'html3', 'html4'
and 'netscape')

+=item B<:escape>
+
+Import the escape and unescape methods
+
=item B<:standard>

Import "standard" features, 'html2', 'html3', 'html4', 'form' and
'cgi'.
@@ -5698,6 +5703,20 @@
),
hr;

+=head2 ESCAPING/ENCODING AND UNESCAPING/DECODING URL STRINGS
+
+URL parameters are encoded in what is also known as Percent-encoding
+L<http://en.wikipedia.org/wiki/Percent-encoding>
+
+ use CGI ':escape';
+ my $string = "Hello World";
+ my $escaped = escape($string);
+ print $escaped, "\n";
+ die "How could unescape(escape($string)) ne $string"
+ unless unescape($escaped) eq $string;
+
+prints out "Hello%20World"
+
=head2 PROVIDING ARGUMENTS TO HTML SHORTCUTS

The HTML methods will accept zero, one or multiple arguments. If you

Peter

Peter Valdemar Mørch

unread,
Jun 28, 2010, 3:05:02 AM6/28/10
to perlfaq...@perl.org
On Jun 27, 4:27 am, brian.d....@gmail.com (brian d foy) wrote:
> > I suggest one of:
> > * Document escape and unescape in perldoc CGI (please, please,
> > please!)
> > * Elaborate on how this escaping and unescaping can be achieved using
> > only the documented interface
>
> Patches welcome :)

CC: Lincoln D. Stein, author of CGI.pm

brian d foy

unread,
Jul 1, 2010, 3:40:48 PM7/1/10
to perlfaq...@perl.org, Peter Valdemar M�rch
[[ This message was both posted and mailed: see
the "To," "Cc," and "Newsgroups" headers for details. ]]

In article
<0bf7e3ae-a65d-4718...@s9g2000yqd.googlegroups.com>,


Peter Valdemar M�rch <pmo...@gmail.com> wrote:

> On Jun 27, 4:27�am, brian.d....@gmail.com (brian d foy) wrote:
> > > I suggest one of:
> > > * Document escape and unescape in perldoc CGI (please, please,
> > > please!)
> > > * Elaborate on how this escaping and unescaping can be achieved using
> > > only the documented interface
> >
> > Patches welcome :)
>
> CC: Lincoln D. Stein, author of CGI.pm

If you are making patches to modules, you should probably post them to
their RT queue (or whatever issue tracking they use). As far as I know,
Lincoln has passed on maintainership of CGI.pm so sending patches to
him is not a good way to get the right people to notice them.

Note that sending any patches to personal email or unrelated mailing
lists is probably the best way to have them ignored. :)

Peter Valdemar Mørch

unread,
Jul 2, 2010, 1:54:21 AM7/2/10
to perlfaq...@perl.org
Although I'm affraid you might be right, I'm trying to do the best I
know how:

From perldoc CGI (e.g. http://perldoc.perl.org/CGI.html):
> Address bug reports and comments to: lst...@cshl.org.

:-(

Peter

brian d foy

unread,
Jul 2, 2010, 5:40:22 PM7/2/10
to perlfaq...@perl.org
In article
<dbee2d8d-1bc1-427c...@c33g2000yqm.googlegroups.com>,

You can always CC authors, but always get it into something that other
people can see. That's why we have RT. Out of date docs can't be
trusted to tell you what to do. :)

Peter Valdemar Mørch

unread,
Jul 3, 2010, 4:15:38 AM7/3/10
to perlfaq...@perl.org
> You can always CC authors, but always get it into something that other
> people can see. That's why we have RT. Out of date docs can't be
> trusted to tell you what to do. :)

Ok, so I created:
https://rt.cpan.org/Public/Bug/Display.html?id=59077

:-)

0 new messages