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

Comments

Projects
None yet
2 participants
@punkUser
Copy link

commented Dec 21, 2012

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

This comment has been minimized.

Copy link
Member

commented Dec 21, 2012

Good catch. Should be fixed now.

@s-ludwig s-ludwig closed this Jan 2, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.