Skip to content

Encoder produces broken output for strings starting with a single quote that require escaping #68

Description

@Aquilosion

When encoding a string that:

  • Requires escaping (e.g. contains a backslash)
  • Starts with a single quote

…the stringifier emits a broken multiline token that cannot be parsed back.

Example input:

const Hjson = require('hjson');

const obj = {
    "test": "'Hello,\\nWorld!'"
};

console.log(Hjson.stringify(obj));

Produces this broken output:

{
  test: ''''Hello,\nWorld!''''
}

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions