Simpel javascript HTMLEncoding

You get to define the "pretty" encoding you self. I have extended the HTMLEncode method to include more predefined characters found here: List of XML and HTML character entity references *

*) How did I extract the data from the table on wikipedia?

I would love it if websites exposed raw data on their website, but until that will happen, we can write javascript which can extract data from websites. The data I used to build the HTML entity table was extracted by running the script below in the developer tool on the website. Try it your self! :-)

The script used to extract the HTML entities

var encodings = {};
$(".wikitable.sortable.jquery-tablesorter tr").each(function() {
  var $tr = $(this);
  var name = $("td:nth-child(1)", $tr).text();
  var decimal = $("td:nth-child(3)", $tr).text().match(/\((.*)\)$/);
  if (decimal!=null) {
    encodings[decimal[1]] = "&"+name+";"
  }
})

Known entities