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

error while parsing semicolons #42

Open
kixorz opened this issue Mar 6, 2015 · 6 comments
Open

error while parsing semicolons #42

kixorz opened this issue Mar 6, 2015 · 6 comments

Comments

@kixorz
Copy link

kixorz commented Mar 6, 2015

Ini spec only allows semicolons to be interpreted as comments when they are in the beginning of the line.
; comment
I'm experiencing bug when parsing the following keypair:
key=value;value;value
value;value;value should be interpreted as a string and instead it's parsed only as value and rest is ignored.

Thanks for considering a fix!

@themightychris
Copy link

There doesn't seem to be any "official" spec just what's popular in implementations... and git is one example that does permit same-line comments: https://git-scm.com/docs/git-config

Maybe an extra parse option is called for?

@kixorz
Copy link
Author

kixorz commented Feb 24, 2016

Extra parsing option would work!

@rijnhard
Copy link

rijnhard commented Mar 3, 2016

so funny enough I had a similar need but for Zend booleans, I already have a pr with tests, but @isaacs hasn't commented yet.
#50

It would be easy to add another decode filter, but may take some screwing around since it changes things a bit

@digitalica
Copy link

i found this issue too. I have values containig html entities. Worked fine in Python... And it was also fixed in PHP (https://bugs.php.net/bug.php?id=51094). Extra parsing option could fix this.

@vintprox
Copy link

vintprox commented Jan 25, 2020

2k20
still needed
thanks to 3dx and such - putting path arrays with semicolons in values... For those who don't want to waste time searching solution: https://www.npmjs.com/package/js-ini

@yeroca
Copy link

yeroca commented Jul 27, 2023

I have the same issue with ; and # both. The WinAPI does not allow comments in the key portion, so these characters are treated as part of the key's value. See https://en.wikipedia.org/wiki/INI_file#Comments_2 for reference.

As stated above, parsing of ; and # in keys should be an option, not mandatory. I ended up forking the code for this reason, and ripped out the key comment processing bits.

(I also converted it to Typescript for easier inclusion in a React-TS app)

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

6 participants