cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Escaping URL's (was Japanese characters in URL)

From: Sterling Hughes <sterling_at_designmultimedia.com>
Date: Mon, 7 May 2001 12:53:19 -0400 (EDT)

On Tue, 8 May 2001, Cris Bailiff wrote:

> ..... utf8 encoding elided...
>
> >
> > Hehe. No clue....
> >
> > What I'm more thinking is if someone sets CURLOPT_URL (I know very little
> > about the command line tool. ;) to:
> >
> > http://www.google.com?search=Johnny Carson's Last %
> >
> > That the url get automagically encoded by cURL...
>
> Not automagically please - I don't want curl to manipulate the URL
> unless I say so... Its good/fine to have a function (curl_escape?) which
> normalises URLS to canonical/legal form, but if I've already done that
> to my URL, it's wrong/broken to do it again. The problem is that you
> don't know if a URL is escaped or unescaped, and can't tell by looking.
>
> E.g.
>
> http://www.google.com?search=Johnny Carson's Last %
>
> should obviously be escaped as:
>
> http://wwww.google.com?search=Johnny%20Carson%27sLast%20%25
>
> but if curl did this automa(tg)ically, what happens when I give it this
> URL?
>
>
> http://wwww.google.com?search=Johnny%20Carson%27sLast%20%25
>
> Does it escape it or not? Why should it, its already correct, but how do
> you know? If it come out as:
>
> http://wwww.google.com?search=Johnny%2520Carson%2527sLast%2520%2525
>
> then you broke it....
>
> Curl could have a switch to say 'escape/normalize this url', but it
> should default to off.
>

I believe that they're are routines out there that will correctly handle
this situation, and will only encode data that needs encoding, in which
case this wouldn't be problem...

-Sterling
Received on 2001-05-08