Albert wrote:
How can I convert some html entities (polish) to a
character which I can use in a javascript alert?
You do not have to. You can declare an encoding for the resource that
includes the codes for the referenced characters and use the characters
as they are. Or you can use the character references in an event handler
attribute value, where they are parsed as CDATA already:
onclick="alert('ńęńą&# x017C;ść');"
The entities are:
ń
ę
ń
ą
ż
ś
ć
Those are character references (_not_ entities), and this has been
discussed shortly before. FWIW:
String.prototype.charRefToUnicode = function()
{
return this.replace(
/&#(([0-9]{1,7})|(x[0-9a-f]{1,6}));?/gi,
function(match, p1, p2, p3, offset, s)
{
return String.fromCharCode(p2 || ("0" + p3));
});
}
alert('ńęńąż&#x 015B;ć'
.charRefToUnicode());
PointedEars