Skip to content
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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Handle double quotes, backslashes, CRs, NLs and tabs #3

wants to merge 10 commits into from

Conversation

gtd
Copy link

@gtd gtd commented Apr 5, 2013

This is not a formal solution to all escaping, but it handles the common cases.

jmoody and others added 10 commits April 2, 2013 23:05
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.
@rylev
Copy link
Owner

rylev commented Apr 7, 2013

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 = ''
Copy link
Owner

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"?

@rylev
Copy link
Owner

rylev commented Apr 7, 2013

It looks pretty good. I'm not going to merge this until the pr you branched off from is merged.

@quietcoolwu
Copy link

Hi @rylev @gtd , I think this change is pretty helpful, is this gem under support now and could this PR be merged? Or do you have any suggestions on the alternatives?

@rylev
Copy link
Owner

rylev commented Jul 31, 2024

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. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants