“the j stands for Journalism”
about me | research blog | wordpress plugins | jQuery plugins

26 February, 2010

How to unescape HTML entities in JavaScript

This is one of those routine web development things which you assume is inbuilt, but actually proves quite tedious to find a nice solution to.

Specifically, I am talking about converting something like ' to ‘ or & to & directly in Javscript.
This function does exactly that! Note how it adds a function to the prototype for String, so is called in the following way:

"Hello José".unescapeHtml()

Find the code here: paul schreiber » Blog Archive » JavaScript: how to unescape HTML entities.

Leave a comment