I have some text, which I want to display using java (on jsp page) and using javacript. but when I use \ then text in javascript is shown correctly but java shows it with one more back slash. the text is the same, is there some way how I can have them displayed the same way?
            Asked
            
        
        
            Active
            
        
            Viewed 252 times
        
    0
            
            
        - 
                    4Could you show us an example, maybe a printscreen and a snippet of your javascript and java code? – Max Feb 04 '14 at 08:17
 - 
                    Has your question been answered yet? – avgvstvs Oct 17 '14 at 00:01
 
1 Answers
0
            
            
        This is what is called an "escape sequence" for a variety of security reasons many characters do not print when written directly in a string literal.
Common c style escape sequences are prefixed with '\' (backslash character) followed by the character to escape
'\\' is the character sequence you're looking for to print a single '\' character.
see older stackoverflow comment.
 - \t Insert a tab in the text at this point.
 - \b Insert a backspace in the text at this point.
 - \n Insert a newline in the text at this point.
 - \r Insert a carriage return in the text at this point.
 - \f Insert a formfeed in the text at this point.
 - \' Insert a single quote character in the text at this point.
 - \" Insert a double quote character in the text at this point.
 - \\ Insert a backslash character in the text at this point.