ini icon indicating copy to clipboard operation
ini copied to clipboard

[BUG] `#` sign stripped from value

Open tukusejssirs opened this issue 3 years ago • 5 comments

What / Why

# sign and everything following it is stripped off.

When

Always

Where

  • n/a

How

Current Behavior

  • n/a

Steps to Reproduce

ini.decode('key=value#value') outputs `{key: 'value'}.

Expected Behavior

ini.decode('key=value#value') should output `{key: 'value#value'}.

Alternatively, if you want to strip comments at the end of the lines, strip only everything after # (whitespace(s) + hash), but not where there is no space/tab before a comment sign (be it # or ;).

Who

  • n/a

References

  • n/a

Related: #89

tukusejssirs avatar Dec 02 '21 13:12 tukusejssirs

but not where there is no space/tab before a comment sign (be it # or ;).

That's not my expectation.

I think to get the desired behavior you would have to do ini.decode('key="value#value"'), and for issue #89 to be resolved.

Either way, this project looks abandoned. Maybe @isaacs can confirm.

xoorath avatar Dec 05 '21 22:12 xoorath

Either way, this project looks abandoned. Maybe @isaacs can confirm.

There are some commits from October 2021, so it seems to be maintained, but the maintainer might be busy with other stuff.

Anyway, my use case was simple, so I used regex and removed the ini dependency. This issue is a deal breaker for me.

tukusejssirs avatar Dec 05 '21 22:12 tukusejssirs

Mm. I didn't see any non-bot commits in over a year, and the issue you linked to hasn't been commented on despite being opened in 2019. That's what I was thinking, at least.

xoorath avatar Dec 05 '21 23:12 xoorath

You can try my fork, ini-win, which aims to be more compatible with the way Windows handles ini files. Windows only supports whole line comments, and so does my fork, so it fixes this issue.

m417z avatar Mar 17 '22 21:03 m417z

Thanks, @m417z, for suggestion, however since I reported this issue I eliminated using a dependency for parsing INI files. :wink:

tukusejssirs avatar Mar 18 '22 00:03 tukusejssirs

This would constitute a breaking change for folks who are relying on the behavior that an unquoted string has and is unlikely to change. If you have values with special characters please escape them or quote them.

> ini.decode('key=value\\#value')
[Object: null prototype] { key: 'value#value' }
> ini.decode('key="value#value"')
[Object: null prototype] { key: 'value#value' }
> ini.encode({ key: 'value#value' })
'key=value\\#value\n'

wraithgar avatar Apr 13 '23 17:04 wraithgar