var cheerio = require('cheerio');
var $ = cheerio.load('<div>泻懈褉懈谢谢懈褑邪</div>');
console.log($.html()); // => <div>кириллица</div>
when expected output is <div>泻懈褉懈谢谢懈褑邪</div>
$('div').text() returns normal, not encoded value
Found a solution in #466 with $.html({decodeEntities: false}), which works fine. Anybody knows what could be the downsides of using this option?
And here's the downside - $('div').html({decodeEntities: false}) returns an object, instead of a string with actual HTML.
Could be solve with nasty hack:
var div = cheerio.load($('div').html());
div.html({decodeEntities: false});
decodeEntities is not an option for .html, but for .load (or the constructor).
Thanks, that helped!
decodeEntitiesis not an option for.html, but for.load(or the constructor).
thanks, this helped me!
Most helpful comment
decodeEntitiesis not an option for.html, but for.load(or the constructor).