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

Escape single quotes in json #286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

dskarbek
Copy link

@dskarbek dskarbek commented Apr 2, 2017

When the json ends up as a payload in a curl command, the single quotes will mess things up.

So, really, this is a curl specific issue. I looked at doing a replace for single quotes in the PrepareCurlRequest method, which would make sense. That is where it is being wrapped in single quotes, so that is where encoding any embedded single quotes is needed. But, it changes the content length which messes up that header, and in general, it seems like your design is that any encoding has already happened. So, I'm thinking maybe you want to move this up-stream to each of your encoders -- just make it a rule that single quote is encoded to avoid problems. Though, that does mean you'd have to enforce this in each style of encoder and it only actually matters when using curl. Maybe there's a call back to the request object that the curl method can made to say, "oh hey, make sure to encode any single quotes".

So, that's why I just proposed this change here instead of in your VBA-JSON repo. Just getting the ball rolling on where you think the right place is for this fix.

Thanks for all your efforts on this library. It is nicely designed and just what we were looking for!

When the json ends up as a payload in a curl command, the single quotes will mess things up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant