Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] # sign stripped from value #142

Closed
tukusejssirs opened this issue Dec 2, 2021 · 6 comments
Closed

[BUG] # sign stripped from value #142

tukusejssirs opened this issue Dec 2, 2021 · 6 comments

Comments

@tukusejssirs
Copy link

tukusejssirs commented Dec 2, 2021

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

@xoorath
Copy link

xoorath commented Dec 5, 2021

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.

@tukusejssirs
Copy link
Author

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.

@xoorath
Copy link

xoorath commented Dec 5, 2021

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.

@Wortason Wortason mentioned this issue Jan 12, 2022
Closed
@m417z
Copy link

m417z commented Mar 17, 2022

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.

@tukusejssirs
Copy link
Author

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

@wraithgar
Copy link
Member

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants