he – Robust HTML Entity Encoder/Decoder with JavaScript

NEW  Video tutorials for jQuery and Javascript are now on Videos page.

he (for “HTML entities”) is a robust HTML entity encoder/decoder written in JavaScript.

It supports all standardized named character references as per HTML, handles ambiguous ampersands and other edge cases just like a browser would, has an extensive test suite, and handles astral Unicode symbols just fine.