]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
CURLOPT_POSTFIELDS.3: fix incorrect C string escape in example
authorHaydar Alaidrus <haydar.alaidrus@gmail.com>
Sat, 23 Dec 2023 19:28:06 +0000 (02:28 +0700)
committerJay Satiro <raysatiro@yahoo.com>
Sat, 23 Dec 2023 20:04:56 +0000 (15:04 -0500)
- Escape inner quotes with two backslashes.

Two backslashes escapes the backslash for the man page and will show as
a single backslash.

eg: "{\\"name\\": \\"daniel\\"}" shows as "{\"name\": \"daniel\"}".

Closes https://github.com/curl/curl/pull/12588

docs/libcurl/opts/CURLOPT_POSTFIELDS.3

index c42cd65fbf099d48e31cf1631c97fa0b5ba9bbe2..6efdb95316ee2e19fdb0a9c6bf106f02cc6466e8 100644 (file)
@@ -97,7 +97,7 @@ int main(void)
   /* send an application/json POST */
   curl = curl_easy_init();
   if(curl) {
-    const char *json = "{\"name\": \"daniel\"}";
+    const char *json = "{\\"name\\": \\"daniel\\"}";
     struct curl_slist *slist1 = NULL;
     slist1 = curl_slist_append(slist1, "Content-Type: application/json");
     slist1 = curl_slist_append(slist1, "Accept: application/json");