Disallowed characters in Javascript

by 4 replies
5
I am using some javascript which displays user-inputted text in a special way.

The problem is, that certain characters (such as ') mess up the script.

Rather than just disallow certain characters, I would prefer to allow all so thought to do this by converting ascii chars. However, even when converted, it still messes up the script.

I am using ASP, although not sure if this has relevance.

Any suggestions?

Thanks,

Ben Shaffer
#programming #characters #disallowed #javascript
  • Probably need to look at the JavaScript escape & unescape functions.
  • Thanks. That worked well on the '. Is there is a more general way of doing this rather than having to replace each suspect character. For example, if I don't know which character will cause the error.
  • What other characters are still giving you grief? Posting some example code would help as well.
  • Hello Ben,

    1.) DevGuru JavaScript Special Characters

    2.) JavaScript Special Characters

    3.) Lookup a Javascript reference book or tutorial

Next Topics on Trending Feed