curl-users
Re: Remove or replace automatically created ampersand (&) as a separating symbol
Date: Mon, 9 Jan 2012 23:52:11 +0100 (CET)
On Mon, 9 Jan 2012, ukasz Wrbel wrote:
> I have simple piece of code: curl -v --get --data-urlencode "some data to
> encode" http://some/target/url=
>
> Curl automatically constructs GET from "base" url and encoded data like
> this: GET /target/url=&some%20data%20to%20encode
>
> Insert ampersand (&) as a separating symbol between "base" url and encoded
> data.
>
> How do I remove automatically created separate symbol (&) or possibly
> replace it with another selected character?
Well, in your particular example curl _doesn't_ add an ampersand so it took me
a while to figure out what you're talking about.
However, if curl finds a question mark in the URL already present, it then
adds the data with a prepended ampersand. Like in:
curl --get --data-urlencode "some one" "localhost/url?moo="
I consider it to be a bug to insert that ampersand prepended to the data, it
is meant to be put as a separator between separate pieces of data.
You want to work on fixing the check?
-- / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-01-09