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
escaped characters not handled correctly in strings #6
Comments
It looks like the issue is that other escaped characters are not properly handled here. |
Patching of strings so that they contain newlines is also problematic, as the newlines are simply copied into the patched string without escaping them. |
Thanks — it looks like the bug is in |
It looks like that fix won't handle the |
Also I'm not 100% clear on what should be done with unknown escape sequences. With this change, golden-fleece will completely drop things like |
Ah yep, |
Oh whoops I missed the I'm a bit more concerned about the |
Opened #12. Those characters won't get escaped upon stringification, but maybe that's okay? |
I think that's good enough for now. If we run into issues or if it surfaces that this isn't json5-compliant, we can revisit - but for now that's definitely better than what there was before. |
Actually the list of characters that json5 officially escapes was pretty easy to find. It might make sense to augment the list I added in #10 to include the couple of extra ones. |
I think all the various cases are handled now (thanks!) — you think we're good to close this? |
Yup I think everything should be covered now. |
If some json5 contains a string containing an escaped newline, in the parsed or evaluated version, that newline will be lost.
This returns an empty string. This also happens with strings containing
\r
or\t
or\\
.Strings containing
\x##
or\u####
escape characters are also not handled correctly. The\x
or\u
is dropped and in the evaluated string the##
or####
is left as-is.The text was updated successfully, but these errors were encountered: