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

jsonUnescape skips a character after \uXXXX unicode sequences. #146

Closed
punkUser opened this issue Dec 21, 2012 · 1 comment
Closed

jsonUnescape skips a character after \uXXXX unicode sequences. #146

punkUser opened this issue Dec 21, 2012 · 1 comment

Comments

@punkUser
Copy link

For instance, the following code will fail to parse, even though it is valid JSON:
string json_test = "{"a":"b\u221a","c":"d"}";
auto json = parseJson(json_test);

The issue seems to be because jsonUnescape pops an extra character while parsing the unicode sequence, and in cases like the above, that will incorrectly drop the ". In other strings it will instead just skip a character in the output.

The while loop in jsonUnescape has a "range.popFront();" at the end of it that works for all cases except the unicode sequence, which internally pops all 5 characters itself. The logic will need some minor modification (move the trailing pop to each of the other cases explicitly or similar) to avoid this problem.

s-ludwig added a commit that referenced this issue Dec 21, 2012
@s-ludwig
Copy link
Member

Good catch. Should be fixed now.

@s-ludwig s-ludwig closed this as completed Jan 2, 2013
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

No branches or pull requests

2 participants