-
Notifications
You must be signed in to change notification settings - Fork 170
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
New line in string raises decode error #28
Comments
According to the JSON spec (RFC 8259) control characters (including newline character - U+000A) must be escaped.
The current implementation strictly follows the spec and does not allow unescaped newlines inside strings. It's up to debate if we should follow the spec here, I think we should. But we also should at least mention this in the "Differences to Poison" section of documentation. There are also explicit tests to refuse such behaviour in the JSON Test Suite. |
Thanks for the explanation! Yes, I also think that we should follow the spec strictly. |
Hello, we're replacing Poison by Jason in a project and it all works great but we found a test case where Poison didn't complain, but Jason does, which involves new lines inside JSON strings.
I've added a test to reproduce it here:
jaimeiniesta@0e03d04
Now, for a little more context, we use helpers like that in out tests:
The newline there is just for readability purposes, but it's what raises the decoding error.
I think that JSON allows to include
\n
in strings, and Poison allows that:The text was updated successfully, but these errors were encountered: