he
A robust HTML entity encoder/decoder written in JavaScript
...It supports all standardized named character references (e.g., ©, —), handles numeric and hex entities, and deals properly with astral Unicode symbols (i.e., code points outside the BMP). The library is designed so that he.decode(input) will safely convert HTML-entity encoded strings into proper Unicode text, and he.encode(text, options) will encode non-ASCII or special characters into safe entity references. It emphasizes correctness, security (avoiding common pitfalls when decoding entities), and broad compatibility (browser, Node.js). ...