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

\u2029 will break down 'vm' #3559

Closed
flyingfisher opened this issue Oct 28, 2015 · 3 comments · May be fixed by B020239/node#1
Closed

\u2029 will break down 'vm' #3559

flyingfisher opened this issue Oct 28, 2015 · 3 comments · May be fixed by B020239/node#1
Labels
invalid Issues and PRs that are invalid.

Comments

@flyingfisher
Copy link

Run following code, will raise an Error: "Unexpected token ILLEGAL"
require("vm").runInThisContext("var b = '\u2029' ")

@targos
Copy link
Member

targos commented Oct 28, 2015

I guess you have to escape the backslash so it stays as-is in the string passed to runInThisContext

@alexeyten
Copy link
Contributor

You could get the same error with simple \n in place of \u2029. That's because they both are line terminators. See good article http://timelessrepo.com/json-isnt-a-javascript-subset

@flyingfisher
Copy link
Author

Yes. Thanks a lot.
This is exactly what I need. And I do think JSON is a subset of javascript.
Now I get it, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Issues and PRs that are invalid.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants