cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: URL encoding in libcurl C++

From: Olivier Austina <olivier.austina_at_gmail.com>
Date: Thu, 14 Nov 2013 22:11:13 +0100

Thank you Dan, I replace spaces by %20 and it works now.

Regards
Olivier

2013/11/14 Dan Fandrich <dan_at_coneharvesters.com>

> On Thu, Nov 14, 2013 at 05:25:09PM +0100, Olivier Austina wrote:
> > I try to use libcurl in C++ with the DBpedia Spotlight examples. this is
> the
> > code following this example. But there is no result. I don't have an
> > annotation.
>
> > char *txt="http://spotlight.dbpedia.org/rest/spot/?text=President Obama
> called Wednesday on Congress to extend a tax break&spotter=LingPipeSpotter";
> >
> > char* data=curl_easy_escape(curl, txt,0);
> >
> > curl_easy_setopt(curl, CURLOPT_URL, data);
>
> The curl_easy_escape function will escape the *entire* string, so you end
> up with a string like
> http%3A%2F%2Fspotlight.dbpedia.org
> %2Frest%2Fspot%2F%3Ftext%3DPresident%20Obama%20called%20Wednesday%20on%20Congress%20to%20extend%20a%20tax%20break%26spotter%3DLingPipeSpotter
> which isn't a URL at all. You should really check the return code of all
> these
> functions to find out where libcurl doesn't like the input.
>
> >>> Dan
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-11-14