Encode and decode HTML entities
var ent = require('ent');
console.log(ent.encode('<span>©moo</span>'))
console.log(ent.decode('π & ρ'));
<span>©moo</span>
π & ρ
Escape unsafe characters in str
with html entities.
Convert html entities in str
back to raw text.
HTML entity tables shamelessly lifted from perl's HTML::Entities
With npm do:
npm install ent
perl