I'm looking to convert a string of html entities specifying ASCII codes (ie: a) to the ASCII characters they represent (ie: a). I'm using a property of an object and trying to assign a value. For instance:
object.Text("");
When I pass is the string representing the entity, I get the same string back. I can't find the function to convert entities to the characters they represented.
To convert all numerical character entities in a string to their character equivalents you can do this:
str.replace(/&#(\d+);/g, function (m, n) { return String.fromCharCode(n); })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With