I have an Android app that retrieves values from a servers database and displays them in the app but carriage returns are coming back as but I need them to act as carriage that will place text below onto a new line.
I first post data to my server to store in database like this:
$body = mysqli_real_escape_string($conn, $_POST['body']);
Then I encrypt the text before storing in database like this
$encryptedBodyText = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $body, MCRYPT_MODE_CBC, md5(md5($key))));
I now get the data from the database and then JSON it to android
$decryptedBody = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($body), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
but when I show this data in the android the new lines are shown as instead of actual new lines.
How can I replace the so they are actual new lines in java
I've tried
String t = sharedBodyText.replace("
",System.getProperty("line.separator"));
bodyText.setText(t);
and it doesn't work but if I change to
String t = sharedBodyText.replace("gg",System.getProperty("line.separator"));
bodyText.setText(t);
it does work if there is "gg" in the body text