I am using ajax to update the content in a textarea and display the content as html. The textarea contains multiple lines. After the backend puts the content to the database, it returns the content in XML. Since I want to display the content as html, I use nl2br() to replace spaces with
. But the problem is
doesn't quite work with XML because it contains special characters < and >. Is there a standard way of encoding and decoding free-input characters with ajax XML transport? Thank you for the help.