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

It may be time to re-evaluate ENT_COMPAT vs. ENT_QUOTES #146

Closed
pinterface opened this issue Apr 26, 2013 · 3 comments
Closed

It may be time to re-evaluate ENT_COMPAT vs. ENT_QUOTES #146

pinterface opened this issue Apr 26, 2013 · 3 comments

Comments

@pinterface
Copy link

Escaping single quotes is good because otherwise <tag attr='{{var}}'> is unsafe, even though it's semantically identical to <tag attr="{{var}}">, which is safe. A recipe for disaster!

Also, at least some of the mustache implementations escape single quotes now:

Mustache.js: escapes single quotes.
mustache (ruby): uses CGI. CGI doesn't escape single quotes in Ruby 1.9.x, but does in Ruby 2.0.
pystache: Single quotes escaped as of Python 3.2.
mustache.go: Escapes single quotes (as &apos;!).

@bobthecow
Copy link
Owner

While I agree with the principle, this is something that should be taken up with the Mustache spec. Until and unless that is changed, escaping single quotes would actually make Mustache.php not spec compliant.

In the meantime, it's possible to use a custom escaper to escape however you want. I would also be cool with adding an engine-level configuration option to override the flags, analogous to the $charset option already provided.

@pinterface
Copy link
Author

I've opened mustache/spec#69, so we'll see where that goes.

I'm already using the custom escaper as a workaround, but I'll take a
look at tackling the configuration option idea.

@bobthecow
Copy link
Owner

This has been released in v2.4.0. Thanks!

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

No branches or pull requests

2 participants