Originally posted by deva siva:
i dont want to replace that char (- ' ), i want to allow this chars, into javascript functions because i need to display the user name on the header as it is.
Which is exactly what "escaping" the character (by preceding it with a "backslash" [\] ) does.
Any time you put a character in a constant text
string you need to "escape" characters that might confuse the programming language. The way languages such as Java, C, C++, C# and Javascript do this is by using '\' as an "escape character" to tell the language parser to leave the next character alone.
However; I notice from your initial question that you are passing information
from one JSP to another. In this case you also need to be careful when building URLs. If you are using a GET request with parameters on the end of the URL you really need to "URL encode" any dangerous or unusual characters. There's plenty of information on tghe web about this, for example
http://sislands.com/coin70/week6/encoder.htm