Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upOdd handling of quotes #2
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
cactus
commented
Oct 1, 2015
|
If you are amenable to the change, I can open a pull req with associated tests. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
walle
Oct 1, 2015
Owner
Thanks for reporting!
I would say that this is expected behaviour, the only character that is special is the line break. Because it would break the line based format if it isn't escaped. But if you write quotes you get quotes :)
This keeps down the number of special cases. E.g. what to do about single quotes, unicode quotes (the quotes that looks like quotes but isn't) and so on. This way everything you put in the key/value will be there. The one special case is line breaks.
But you are right that it's a bit confusing. I will add a test case that verifies that this is the intended behaviour.
If I'm missing something here please tell me.
|
Thanks for reporting! I would say that this is expected behaviour, the only character that is special is the line break. Because it would break the line based format if it isn't escaped. But if you write quotes you get quotes :) This keeps down the number of special cases. E.g. what to do about single quotes, unicode quotes (the quotes that looks like quotes but isn't) and so on. This way everything you put in the key/value will be there. The one special case is line breaks. But you are right that it's a bit confusing. I will add a test case that verifies that this is the intended behaviour. If I'm missing something here please tell me. |
walle
closed this
Oct 1, 2015
added a commit
that referenced
this issue
Oct 1, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
cactus
commented
Oct 1, 2015
|
Maybe adding some clarifying text to the readme would help too? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Great idea! I will do so. |
cactus commentedOct 1, 2015
If I modify decode_test.go with the following...
Then adjust the tests to handle that case, I see this result.
Is this expected? Most other "INI-like" formats strip quotes from the front and back of strings in this case.
Adding this to GetString makes it behave as I would expect.