From: John Bokma on
"Brian McCauley" <nobull67(a)gmail.com> wrote:

> Hang on, didn't you just say there was a W3C standard?

As far as I know there isn't such a thing as a W3C standard :-D.

--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/
From: Cloink on
Look Brian clever clogs McCauley, I spent hours trawling the web, don't
come your "You haven't tried hard enough," sneering down your nose at
me. The FAQ. THE faq. Which one? I frequently ask myself "Why o
why?" but I don't think you meant that FAQ. I am encoding using
standardised javascript functions. I searched on those functions. I
found nothing useful. I don't enjoy wasting my time, and I certainly
ain't taking any gip off you.

Do you really need a link to the ECMAscript v3 definition of
encodeURI/encodeURIComponent/decodeblahblah when you can look it up in
the Rhino book? Sorry if I used the wrong terminolgy when I said W3C,
I'm not a geek.

Nevertheless, I'm sure many people have sat round a table and decided
that the best way to encode a URL (sorry, URI, mustn't get the jargon
wrong) is by the method that encodeURI/Component does it. So if that's
the way that javascript encodes it, bearing in mind that javascript
communicates http requests with Perl a zillion times a day on the
tinterweb, how come I'm finding it so hard to find a reference to a
Perl function that decodes via the reverse algorithm?

Talking of algorithms, the only almost-useful bit of your reply doesn't
actually explain the algorithm by which one reaches xC3xA9 from u00E9.
Which would've been nice.

Thanks for your time.

Brian McCauley wrote:
> On Jan 18, 1:33 pm, "Cloink" <Cloink_Frigg...(a)ntlworld.com> wrote:
> > Simply: How ?
>
> This is (almost) FAQ: "How do I decode or create those %-encodings on
> the web?"
>
> > I can't believe no-one's already done it, but I can't find any exact
> > mention of it on the tinterweb.
>
> But there is (almost) an exact mention in the FAQ.
>
> > Closest I got was someone suggesting a custom javascript function to
> > encode a URI in the style that Perl expects - no way José - what's the
> > point in the W3C standardising this stuff for all our benefits if we go
> > and write custom functions instead.
>
> If you are going to mention a standard it's couresy to provide a link.
>
> > So come on - I need a Perl function to decode a URL that has been
> > encoded with a javascript encodeURI() or encodeURIComponent() call.
> >
> > Alternatively, I can write the Perl function myself if someone can
> > explain how the encoding works in the js funcs?
>
> Hang on, didn't you just say there was a W3C standard?
>
> > e.g.
> > é (e-acute) is encoded via encodeURIComponent to %C3%A9, which doesn't
> > obviously tie in with the Unicode specification 00E9. But the js
> > references I've read claim that it is Unicode compliant, so what am I
> > missing?
>
> Unicode gives each character a "code point". That is a pure number. The
> way that number is encoded as a byte sequence is another thing. Unicode
> defines a number of such encodings. The way U+E9 is represented in the
> most common Unicode encoding (utf8) is the byte seqence 0xC3,0xA9. So
> it looks like encodeURIComponent is encoding the utf8 byte seqence.

From: Cloink on
Thanks Reinhard, but does that definitely decode a URL encoded with
JavaScript's encodeURI/ encodeURIComponent ? The copyright says 1997
and I don't think the js functions have been around that long. Plus,
I've already parsed my query string into key/value pairs, I just need
to decode the %xx[%xx[%xx]] characters either into their unicode uxxxx
representations or genuine characters.

Reinhard Pagitsch wrote:
> Cloink wrote:
> > Simply: How ?
> >
> > I can't believe no-one's already done it, but I can't find any exact
> > mention of it on the tinterweb.
> >
> > Closest I got was someone suggesting a custom javascript function to
> > encode a URI in the style that Perl expects - no way José - what's the
> > point in the W3C standardising this stuff for all our benefits if we go
> > and write custom functions instead.
> >
> > So come on - I need a Perl function to decode a URL that has been
> > encoded with a javascript encodeURI() or encodeURIComponent() call.
> >
> > Alternatively, I can write the Perl function myself if someone can
> > explain how the encoding works in the js funcs?
> >
> > e.g.
> > é (e-acute) is encoded via encodeURIComponent to %C3%A9, which doesn't
> > obviously tie in with the Unicode specification 00E9. But the js
> > references I've read claim that it is Unicode compliant, so what am I
> > missing?
> >
> > Cheers all.
> > Cloink
> >
>
> Maybe the following modules will help you:
> CGI::Deurl and CGI::Enurl
>
> regards
> Reinhard
>
> --
> PM Mails an rpirpag <at> gmx dot at

From: Thomas Wasell on
In article <1169211741.678652.189990(a)l53g2000cwa.googlegroups.com>,
Cloink_Friggson(a)ntlworld.com wrote:
>Look Brian clever clogs McCauley, I spent hours trawling the web, don't
>come your "You haven't tried hard enough," sneering down your nose at
>me. The FAQ. THE faq. Which one? I frequently ask myself "Why o
>why?" but I don't think you meant that FAQ. [...]

Did you try

http://www.google.com/search?q=perl+FAQ

--
"Think about it. With discoveries like mine,
most of you would probably just explode."
-- JSH debating the finer points of
mathematics
From: Paul Lalli on
Cloink wrote:
> Look Brian clever clogs McCauley, I spent hours trawling the web, don't
> come your "You haven't tried hard enough,"

Trying long is no where near the same as trying hard.

> sneering down your nose at
> me. The FAQ. THE faq. Which one?

Are you really that dense? You posted a question to a *Perl*
newsgroup, and someone tells you to look at the FAQ, and you can't
figure out that means "The Perl FAQ"? Cripes, no wonder you're having
so much difficulty.

Paul Lalli