$.html() encoding apostrophes
See original GitHub issueHaving quotes in quotes and calling html on it encodes the inside quotes. jQuery .html correctly returns the desired output (not replace '
with '
)
console.log(require('cheerio').load('<div ng-include="\'views/main.html\'"></div>').html());
// <div ng-include="'views/main.html'"></div>
Issue Analytics
- State:
- Created 10 years ago
- Comments:25 (9 by maintainers)
Top Results From Across the Web
HTML code for an apostrophe - ascii - Stack Overflow
Use ' for a straight apostrophe. This tends to be more readable than the numeric &# ...
Read more >How to create the apostrophe symbol in HTML - Educative.io
An entity name, entity number, or hexadecimal can be used to add special characters/symbols to an HTML webpage. One such symbol is the...
Read more >Should I escape the Apostrophe ( ' ) character with its HTML ...
"If your apostrophe belongs to content, escape it." - This would seem to be incorrect (as if missing the word "don't"). If the...
Read more >HTML Entities - W3Schools
Some Useful HTML Character Entities ; &, ampersand, & ; " double quotation mark, " ; ' single quotation mark (apostrophe), ' ;...
Read more >How do I show an apostrophe in HTML? - Gzipwtf.com
Encoding. The letter apostrophe is encoded at U+02BC ʼ MODIFIER LETTER APOSTROPHE (HTML ʼ ). In Unicode code charts it looks identical to...
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
Have you tried to run it with
decodeEntities: false
?I’ll jump in on this one. In my case I am appending an image tag with a src url with query params. In theory, it should not matter that it replaces the & with &. But it does matter because in this case: the output is an email, not a browser and the & is being interpreted as written so that my query params come in as amp;qname. I have a workaround which to unescape the output of .html(), but really I should not have to in this case and I have some concerns about what may happen if a legitimately escaped string comes in and we unescape it. Anyway, food for thought.