How can I convert some html entities to character

A

Albert

How can I convert some html entities (polish) to a character which I can use in a javascript alert?

The entities are:
ń
ę
ń
ą
ż
ś
ć
 
T

Thomas 'PointedEars' Lahn

Albert said:
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('ńęńążść');"
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('ńęńążść'
.charRefToUnicode());


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top