Take advantage of char codes to refactor escaping

References:

* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt
* https://gist.github.com/mathiasbynens/1243213
* http://www.w3.org/TR/html4/sgml/entities.html