ini icon indicating copy to clipboard operation
ini copied to clipboard

Encode values without quoting (unsafe encoding)

Open schroffl opened this issue 8 years ago • 3 comments

When encoding a Base64 String with padding, the parser quotes it. But since another parser does not understand these quotes, it fails to decode the string.

let buf = new Buffer(16), // Buffer filled with random bytes
    section = ini.parse('[section]\nkey=' + buf.toString());

console.log(section); // { section: { key: 'UPIvqf0AAABA5i+p/QAAAA==' } }
console.log(encode(section)); // key="4EQ8rlYAAAAQlTWuVgAAAA=="

Hence I suggest to add an option to allow for unsafe encoding.

schroffl avatar May 14 '16 12:05 schroffl

+1

curcuz avatar Jan 18 '17 20:01 curcuz

I would like to have the option too, since safe breaks aws credentials file

jurijzahn8019 avatar Dec 21 '18 11:12 jurijzahn8019

You can try my fork, ini-win, which aims to be more compatible with the way Windows handles ini files. It quotes the value only in two cases, if the value has leading or trailing whitespace, or if the value is already quoted.

m417z avatar Mar 17 '22 21:03 m417z

You can try my fork, ini-win, which aims to be more compatible with the way Windows handles ini files. It quotes the value only in two cases, if the value has leading or trailing whitespace, or if the value is already quoted.

Thanks for your fork!

dertanzer avatar Nov 29 '22 09:11 dertanzer

If this is something folks still need feel free to submit a PR implementing this flag.

wraithgar avatar Apr 13 '23 17:04 wraithgar