cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Spaces in URLs

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 20 Aug 2002 09:34:23 +0200 (MET DST)

On Tue, 20 Aug 2002, Holger Rauch wrote:

> > In short: you deal with them, not libcurl.
>
> So, if I get this right, there's no such thing as a function taking care of
> the encoding?

Yes and no. There's the curl_escape() function that can URL encode a given
string for you, but you will need to take care as you don't want the full
string URL encoded (for example, the function can't know if the slashes are
meant as slashes or if they should be URL encoded to be passed literally).

> > This is not a valid URL. URLs cannot contain spaces. They need to be
> > translated to %20.
>
> Does that mean that literally writing %20 for each space is enough?

Yes, as long as the spaces are the only letters that invalidates the URL. But
if you're accepting anything from a user or another program or so, you should
be careful to properly escape/encoded all letters that are "reserved" in the
URL format.

-- 
 Daniel Stenberg -- curl related mails on curl related mailing lists please
-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
Received on 2002-08-20