Skip to content

\u2029 will break down 'vm' #3559

Closed
B020239/node
#1

Description

@flyingfisher

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

Activity

  1. targos commented on Oct 28, 2015

    @targos
    Member

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

  2. alexeyten commented on Oct 28, 2015

    @alexeyten
    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

  3. flyingfisher commented on Oct 28, 2015

    @flyingfisher
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidIssues and PRs that are invalid.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions