Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

"escape" sanitization strategy also creates HTML entity literals (?) when used with filter #1712

Open
jogjayr opened this issue Mar 10, 2017 · 2 comments

Comments

@jogjayr
Copy link

jogjayr commented Mar 10, 2017

Subject of the issue

If a translation has an ampersand & in it, it is rendered as "&" when the key is translated with the filter.

Your environment

  • version of angular-translate - 2.9.0
  • version of angular - 1.5.8
  • which browser and its version - Chrome 56

Steps to reproduce

https://plnkr.co/edit/OUEIxqAaAK5iYaeL0A74?p=preview

Expected behaviour

Both the translate filter and translate directive should give the same output: &

Actual behaviour

Translate filter encodes into HTML entity: &

The documentation states:

"Currently there is an issue with the sanitize mode, it will double encode UTF-8 characters or special characters. Recommendation: use the 'escape' strategy, until this is resolved."

Am I reading the documentation wrong?

@knalli
Copy link
Member

knalli commented Mar 14, 2017

Note/reminder:

It looks like your environment is using an old or older release of AngularJS and/or angular-translate. After updating your dependencies, please check and verify your issue again.

I've updated the plnkr template just now also.

@knalli
Copy link
Member

knalli commented Mar 14, 2017

And: A filter output is being escaped by AngularJS. I've made an overview of the available modes at http://plnkr.co/edit/rJ0R6GzHGbMVxhSa237C?p=preview. Also we have open discussion about solutions under the label ref:sanitization

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

No branches or pull requests

2 participants