I have a Java program that stores a message like “test1\r\ntest2” into DB – when I print this out it gives me new line.
The other thread is reading strings from DB and sending them to output with “\r\n” and when I try to print this out it doesn’t give me newline – it just prints out “test1\r\ntest2”
Should I change the encoding of the output?
The application is deployed on tomcat with UTF-8 encoding set.
Thanks in advance.
Are the strings actually stored in the database as “\r\n”?
In that case I think you have to do a
String correct = dbString.replace("\\r\\n","\r\n")on the strings returned from the database.