using javascript, is there a way to replace the special character code's with the special character?
For example:
& becomes &
© becomes ©
Thanks!!
Asked
Active
Viewed 2,855 times
2

Rik de Vos
- 3,467
- 5
- 28
- 34
-
I've updated my answer, I guess it is what you're looking for! – Shaokan Aug 03 '11 at 23:50
-
Replace in what, the HTML stream or in JavaScript strings? – Ray Toal Aug 04 '11 at 00:05
2 Answers
2
Take a look here: http://www.strictly-software.com/htmlencode
The Encoder.js file from that page seems to do what you're asking for.

Gustavo Giráldez
- 2,610
- 18
- 12
0
See Cerebrus' answer in this post
EDIT
Actually KooiInc's answer is exactly what are you are looking for
-
Is it? I think the OP is saying "given the entity, replace it with the character." The linked post is going the other way, from character to entity. Of course, maybe the OP _meant_ to ask the question Kooilnc answered but it doesn't look that way from the way it was phrased. – Ray Toal Aug 04 '11 at 00:08
-
You're right, 3 AM here misunderstood the question. But still, he can always do the other way around. Just build a for statement which goes throug 0 to whatever is the max entity, and then checks whether the entity matches with the html code. – Shaokan Aug 04 '11 at 00:20