Quotes and other special characters get HTML encoded
See original GitHub issueVariables with special characters such as single and double quotes get HTML encoded.
For example:
{
"test1": "Hello ' <> \" characters",
"test2": "Hello {{replace}}"
}
18n.__('test1');
18n.__('test2', {replace: '<> \' "'});
will result in the following strings
test1 = "Hello ' <> " characters"
test2 = "Hello <> ' ""
Is this a bug because I can’t find a configuration to disable HTML encoding
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Common HTML entities used for typography - W3C Wiki
These are the members of the automated “Smart Quotes” set of characters incorporated into most popular word processing platforms. They are often encoded...
Read more >Special Characters in HTML - DeGraeve.com
Special Characters in HTML ; right double quote, ” ; double low-9 quote, „ ; dagger, † ; double dagger, ‡ ; per...
Read more >HTML codes and HTML special characters: The complete list
Character Entity name Entity number Hex Code Description
A A A A Capital A
a a a a Lowercase A
À À À À Capital A‑grave...
Read more >Escaping Quotes & other special characters to get HTML ...
I have Excel cells that contain Newlines, Quotes & few more special characters. I wrote a formula in the last column which is...
Read more >HTML URL Encoding Reference - W3Schools
Character From Windows‑1252 From UTF‑8
space %20 %20
! %21 %21
" %22 %22
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mashpie I found those issues as well, though I’m not rendering any HTML, the strings above come straight from i18n. Just found out i18n is using Mustache, so adding 3 brackets
{{{ ... }}}
fixes the issue.So the following PR is no longer needed https://github.com/mashpie/i18n-node/pull/366
feel free to submit an improving PR.
It should posibly also adress the following:
People using mustache should Know how to use it https://github.com/janl/mustache.js#variables
People wanting to opt-out can do so by i18n.configure({mustacheConfig.disable: true}) as described quite high in https://github.com/mashpie/i18n-node#list-of-all-configuration-options