Jason Jason - 7 days ago 8
C Question

c use libcurl curl_easy_perform post, spaces and dot replaced by underscore

c use libcurl curl_easy_perform post, spaces and dot replaced by underscore

The code is like the example below.

On the other side the received data is wrong:

Expect:

<Text>data to send...</Text>


Actually:
<Text>data_to_send___</Text>


CURL *curl = curl_easy_init();
if(curl) {
const char *data = "<Text>data to send...</Text>";
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
}


Does anybody know the reason?

Answer

That's an incorrect conclusion so the question ends up rather useless.

libcurl will send the data exactly as you provide it with CURLOPT_POSTFIELDS. If the data end up looking different in some presentation layer of yours, then it was either changed or displayed like that by some other layer/software component.

Comments