I am trying to print a text which is fetched from the server. What is the best way to escape all special characters and print safely? 
Because the string which is fetched from the server is entered by user an stores it on database. So there is a possibility use `<?php ?>` , `&` etc which may cause errors. I have tried `&lt; &gt;` which solved this problem. 
But when setText() the string to an EditText the string gets truncated after `&`

So I need a best solution in which the text entered by the user will save safely in the database and retrieve the multi-line string with special characters safely. 

What is the best way to do this?