Encode and decode HTML entities

Status: this should escape text correctly, and it should mostly unescape text correctly. Unfortunately, expanding entities correctly is fraught with historical reasons.

Fortunately, the fine folks at WHATWG have figured it out.

License

This project dual-licensed under the Apache 2 and MIT licenses. You may choose to use either.

Contributions

Unless you explicitly state otherwise, any contribution you submit as defined in the Apache 2.0 license shall be dual licensed as above, without any additional terms or conditions.