in reply to Escape and Un-escape codes

Since you have not shown the code in question, I can only guess as to your intentions. As tye mentioned, if you provide us with the code in question, we can comment on it.

On the off chance that this code is being used for taint checking, please discard it as what you describe is very dangerous from a security standpoint. When checking a user's input, it is much safer to specify what you will allow, as opposed to specifying what you won't allow. The former is often too restrictive, but safe; it can be loosened up as need arises. The latter follows the Microsoft model: make it easy to use, but plug security holes after people are burned.

A classic case is people checking to ensure that the pipe character "|" is not in input, while being unaware that some Unix variants use a caret "^" for redirection instead of a pipe. Who thinks of a caret as being a dangerous character?

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just go the the link and check out our stats.