Skip to content

Control characters must be escaped #36

@XeroAlpha

Description

@XeroAlpha

Tell us about your environment

  • Node Version:16.11.0
  • comment-json Version:4.2.3

Please show your use case / code slices / code link that could reproduce the issue

assert.equal(JSON.stringify('\x0B', null, 4), '"\\u000b"'); // Success
assert.equal(require('comment-json').stringify('\x0B', null, 4), '"\\u000b"') // AssertionError: '"\x0B"' == '"\\u000b"'

What did you expect to happen?

All control characters should be escaped, according to jsonc-scanner/scanner.ts#171

Are you willing to submit a pull request to fix this bug?

No. Reverting commit aa234e5 can fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions