Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: Fix incorrect C string escape in CURLOPT_POSTFIELDS #12588

Closed
wants to merge 1 commit into from

Conversation

haydaralaidrus
Copy link
Contributor

The string literal incorrectly formatted. The backslashes in the JSON string not properly escaped, leading to invalid C syntax:

const char *json = "{"name": "daniel"}";

Where it should be:

const char *json = "{\"name\": \"daniel\"}";

The string literal incorrectly formatted. The backslashes in the JSON string not properly escaped, leading to invalid C syntax.

Signed-off-by: Haydar Alaidrus <haydar.alaidrus@gmail.com>
@jay
Copy link
Member

jay commented Dec 23, 2023

Thanks. I landed it with two backslashes as the escape because one backslash escapes the other and it shows as a single backslash.

@haydaralaidrus
Copy link
Contributor Author

@jay Got it, thank you.

jay added a commit to jay/curl that referenced this pull request Dec 23, 2023
- Check to make sure all backslashes in EXAMPLE are properly escaped.

eg manpage must always use `\\n` never `\n`.

This is because the manpage requires we always double blackslash to show
a single backslash. Prior to this change an erroneous single backslash
would pass through and compile even though it would not show correctly
in the manpage.

Ref: curl#12588

Closes #xxxx
jay added a commit to jay/curl that referenced this pull request Dec 23, 2023
- Check that all backslashes in EXAMPLE are properly escaped.

eg manpage must always use `\\n` never `\n`.

This is because the manpage requires we always double blackslash to show
a single backslash. Prior to this change an erroneous single backslash
would pass through and compile even though it would not show correctly
in the manpage.

Ref: curl#12588

Closes #xxxx
jay added a commit that referenced this pull request Dec 28, 2023
- Check that all backslashes in EXAMPLE are properly escaped.

eg manpage must always use `\\n` never `\n`.

This is because the manpage requires we always double blackslash to show
a single backslash. Prior to this change an erroneous single backslash
would pass through and compile even though it would not show correctly
in the manpage.

Co-authored-by: Daniel Stenberg

Ref: #12588

Closes #12589
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants