-
Notifications
You must be signed in to change notification settings - Fork 96
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
ASCIIPropertyListParser: allow escaping chars that needn't be escaped #45
Conversation
At the moment invalid escape sequences would lead to a failure in parsing the file. This is acceptable I believe. With your commit they would be treated as if they were correct. Furthermore your code even assumes they have a special meaning, that the following character is just needlessly escaped. But there is no way to be sure that, for example, "\d" should be interpreted as "d" and not as "$". The creator of the property list may have defined his own custom escape sequences, only supported by his own parser. Or he may have simply made a mistake. Whatever the reason for the invalid escape sequence, it remains invalid. Thus, I won't accept your pull request. |
Are you aware that "defaults" interprets the characters as my pull request does (this was in the code, I'm not sure if you caught it):
|
\a is an alert bell (see https://en.wikipedia.org/wiki/Escape_sequences_in_C) These characters are apparently not supported in ASCII plists. Remove them from your sample string and you'll get consistent output between defaults and Xcode. So I see two options:
Which do you prefer? I'm happy with either one. |
I already improved the exception text thrown when an invalid escape sequence is encountered in b8d6987. The only actual reference describing the ASCII property list format I found at http://www.gnustep.org/resources/documentation/Developer/Base/Reference/NSPropertyList.html In reality tools like
Would that be fine with you? |
Not sure what I'm mostly concerned about the single quote. We had tooling which escaped these single quotes (maybe it was an old version of Xcode, or maybe internal tooling) when it wrote Localizable.strings files - the Xcode build process is fine with these. |
Alright, now I've just added a switch case to allow for the single quote (See 44ecdc2). I will leave out the other C escape sequences for the moment as nobody else was bothered by the missing support so far. |
Great! Thank you. |
I changed this PR's commit to simply add a test for escaping the single quote. Can you merge it in the current form? |
Done |
No description provided.