2

using javascript, is there a way to replace the special character code's with the special character?

For example:
& becomes &
© becomes ©

Thanks!!

Rik de Vos
  • 3,467
  • 5
  • 28
  • 34

2 Answers2

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

Community
  • 1
  • 1
Shaokan
  • 7,438
  • 15
  • 56
  • 80
  • 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