TextArea <br> and newline

TextArea <br> and newline

Hello,

I have read numerous threads related to TextArea and newlines but I haven't found one that describes a solution that has worked for me.

What I want to be able to do is put an instance of TextArea in a FormPanel, have the user enter multiple lines of text in it, save the text in a db on the server (including the newlines), and send the text back to the client at some point and display it in the TextArea instance newlines and all just as it looked when the user entered it.

Presently I escape the newlines in the text on the server before it is sent to the client using JSON (so the text as a javascript string might look like "this\nis\nsome\ntext") but I found out that that doesn't work because the text is displayed as HTML. So next I tried sending the text back with the newlines replaced with "<br />" but just as with the newlines "<br />" was simply displayed.

I'm probably missing something obvious and may have very well failed to enter the correct search terms into the forum search to find what I'm looking for. Others must have tackled this issue 100X over....what am I missing?

If it is still showing up with <BR> tags then you arent in fact doing a replace on the server. Firebug can inspect the ajax communication to see for sure.
I typically run the replace regex on the client side when i need to do this.