On Feb 10, 2006, at 1:11 PM, [EMAIL PROTECTED] wrote:
Let's say I have a string: "A—B"
I want to set the contents of some element, or even the value of some
attribute of an element, to "A---B" (where --- is the unicode for the
— entity).
Is there are generic way to escape entities?
It'd have to be something along these lines, I guess:
unescapeEntities = function (s) {
var d = document.createElement("DIV");
s = s.replace(/</g, "<").replace(/>/g, ">");
d.innerHTML = s;
s = d.innerHTML;
return s.replace(/</g, "<").replace(/>/g, ">");
};
-bob