Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

String.prototype.encodeHTMLEntities, Encoding HTML Entities with JavaScript

Got a decode version?

A 'decoded' version is there: http://stackoverflow.com/questions/1354064/how-to-convert-characters-to-html-entities-using-plain-javascript from user Chris. 34quo38amp is 34->quot, 38->amp and so on...

Why stop at U+2666? Seems arbitrary. Anyway, for a solution that correctly encodes all except safe & printable ASCII symbols in the input (including astral symbols!), and implements all named character references (not just those in HTML4), use the he library (relevant Stack Overflow answer).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.