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

Support less-aggressive character encoding #9

Closed
twostraws opened this issue Nov 24, 2016 · 3 comments
Closed

Support less-aggressive character encoding #9

twostraws opened this issue Nov 24, 2016 · 3 comments

Comments

@twostraws
Copy link

Right now swift-html-entities aggressively encodes everything, even when it's perfectly acceptable inside HTML. For example, line breaks become 
.

HE, the library this is based on, has an escape() function that "takes a string of text and escapes it for use in text contexts in XML or HTML documents… only the following characters are escaped: &, <, >, ", ', and `." PHP has a htmlspecialchars function that does something similar, although it ignores backticks.

Is it possible to get something similar here?

@youming-lin
Copy link
Collaborator

youming-lin commented Dec 1, 2016

@twostraws Based on my observation, by default he only escapes &, <, >, ", ', and ` in the ASCII space. Are these six characters enough?

@twostraws
Copy link
Author

Yes, I think that ought to be safe for general rendering of content.

@youming-lin
Copy link
Collaborator

Code has been updated to skip the non-printing ASCII characters when escaping in #11.

Along with additional changes to the package to bring it more in line with he's encode options, a new version 3.0.0 release has been tagged.

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

No branches or pull requests

2 participants