Apparently, this is harder to find than I thought it would be. And it even is so simple...
Is there a function equivalent to PHP\'s htmlspecialchars built into Javas
Reversed one:
function decodeHtml(text) { return text .replace(/&/g, '&') .replace(/</ , '<') .replace(/>/, '>') .replace(/"/g,'"') .replace(/'/g,"'"); }