There’s more to HTML escaping than &, <, >, and ” – wonko.com

If I had a dollar for every HTML escaper that only escapes &, <, >, and “, I’d have $0. Because my account would’ve been pwned via XSS.”
This was exaggeration for effect—there aren’t many cases where a simple XSS injection could actually empty a bank account—but I wanted to make a point.

By some coincidence, I’ve found myself working with various open source projects recently that take a half-assed approach to HTML escaping. It’s something that tends to be implemented as an afterthought, which is unfortunate because it can be critical for the security of users of these projects. I won’t name any names in this post (pull requests are forthcoming), but I will explain some of the common problems I’ve seen, why they’re problems, and what can be done to fix them.