-
Notifications
You must be signed in to change notification settings - Fork 14
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
Handle double quotes, backslashes, CRs, NLs and tabs #3
base: master
Are you sure you want to change the base?
Conversation
…de i did not understand in the rake file
As per best practice in lib development.
This is more or less a hack based on information gleaned from http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/LoadingResources/Strings/Strings.html It only escapes NLs, CRs, tabs, double quotes and backslashes. Unicode escapes are not handled because I don't need them right now. In the case of unknown characters it does not remove the backslash which I did to be minimally invasive, however I did not confirm the actual behavior on Apple's side.
Thanks for contributing! I really appreciate it. |
# http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/LoadingResources/Strings/Strings.html | ||
def unescape_value(string) | ||
state = :normal | ||
out = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the name "out". How about "output"?
It looks pretty good. I'm not going to merge this until the pr you branched off from is merged. |
This gem is no longer supported unfortunately. I don't have any suggestions on alternatives, sorry. Feel free to fork the repo, and continue its development. 😄 |
This is not a formal solution to all escaping, but it handles the common cases.