ini icon indicating copy to clipboard operation
ini copied to clipboard

error while parsing semicolons

Open kixorz opened this issue 10 years ago • 7 comments

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!

kixorz avatar Mar 06 '15 04:03 kixorz

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?

themightychris avatar Feb 23 '16 01:02 themightychris

Extra parsing option would work!

kixorz avatar Feb 24 '16 18:02 kixorz

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. https://github.com/npm/ini/pull/50

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

rijnhard avatar Mar 03 '16 14:03 rijnhard

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.

digitalica avatar Mar 15 '16 07:03 digitalica

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

vintprox avatar Jan 25 '20 21:01 vintprox

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)

yeroca avatar Jul 27 '23 20:07 yeroca