I am parsing some data from feedburner of which contains HTML entities. I am trying to encode the HTML entities using jQuery as such:
var encodedStr = data['1']['result']['content']; // content with HTML entities
$("#content").html(encodedStr).text();
but with no results.
Here is what its parsed: http://jsbin.com/ihadam/1/edit
Basically you should encode your html entities into html as such:
Then get the encoded text and apply it as html() as such:
That should work.
Demo: http://jsbin.com/ihadam/9/edit
You can save the bloat of JQuery with pure JavaScript functions.
Sometimes you just want to encode every character... This function replaces "everything except for nothing" in regxp.