Skip to content

Configs with backslashes don't survive round-trip serialization. #350

@ClaytonHughes

Description

@ClaytonHughes

Version Information
From Nuget: Hocon and Hocon.Configuration 2.0.3

(Reproduced on dev, (482a9c1), with failing tests, here: ClaytonHughes@0e55a7c)

Describe the bug
When configurations are serialized, backslashes are not escaped. This means a round-trip serialization of a Config will not succeed.

To Reproduce
Steps to reproduce the behavior:

  1. Have a backslash in your Config (e.g. by parsing a string with an escaped backslash)
  2. Serialize it - note the output is incorrect (backslashes are not escaped)
  3. Parse the serialization - note the tokenizer exception because of the invalid input

Expected behavior
Configurations serialize into valid Json/HOCON (backslashes are escaped).

Actual behavior
Configurations do not escape backslashes, producing (likely) invalid Json/Hocon.

Environment
net461, netcoreapp2.1

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