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 U+2028 and U+2029 when writing JSON as a JavaScript string literal #77

Merged
merged 1 commit into from
Apr 29, 2014
Merged

Escape U+2028 and U+2029 when writing JSON as a JavaScript string literal #77

merged 1 commit into from
Apr 29, 2014

Conversation

nolanw
Copy link
Contributor

@nolanw nolanw commented Apr 16, 2014

U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR are not allowed in a JavaScript string literal, though they are valid JSON. Trying to send a message with either causes an "unexpected EOF" exception on the JavaScript side. Here's a relevant blog post on the issue.

You can test this by doing something like [_bridge send:@"A string sent\u2028 from ObjC to JS" responseCallback:nil].

…eral.

U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR are also not allowed in a JavaScript string literal. Trying to send a message with either would cause an "unexpected EOF" exception on the JavaScript side.
@nolanw
Copy link
Contributor Author

nolanw commented Apr 29, 2014

Are there any reservations to this? Or can I add anything that might help?

@marcuswestin
Copy link
Owner

Hey! Dude, sorry for the absent response! I am traveling and am not as responsive as usually. Github should have an "out of office, be back in June" auto-reply option :)

Looks great, thanks for taking the time to PR and follow up.

Cheers!

marcuswestin added a commit that referenced this pull request Apr 29, 2014
Escape U+2028 and U+2029 when writing JSON as a JavaScript string literal
@marcuswestin marcuswestin merged commit c318771 into marcuswestin:master Apr 29, 2014
@nolanw
Copy link
Contributor Author

nolanw commented Apr 29, 2014

Thank you!

@nolanw nolanw deleted the fix-json-as-string-literal branch April 29, 2014 20:57
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.

2 participants