Note that the current approach returns incorrect results because it doesn’t account for <http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#table-charref-overrides>.