Skip to content

parsecfg stores "\r\n" line breaks just as "\n" #12970

Closed
@simonkrauter

Description

@simonkrauter

When you store a string with Windows line breaks, it just writes "\n" line breaks to the config file.
This is a problem, when the application stores and reads strings and needs Windows compatible line breaks for further usage.

Example

import parsecfg

var cfg = newConfig()
cfg.setSectionkey("Sec1", "Key1", "a\r\nb")
cfg.writeConfig("test.cfg")

cfg = loadConfig("test.cfg")

doAssert cfg.getSectionvalue("Sec1", "Key1") == "a\r\nb"

Current Output

Error: unhandled exception.

File contents:

[Sec1]
Key1="a\nb"

Expected Output

No exception.

File contents:

[Sec1]
Key1="a\r\nb"
$ nim -v
Nim Compiler Version 1.0.4

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