tags:

views:

726

answers:

2

Hi,

If have a field in my database with crlf's how do I preserve that in HTML??

Is there a standard way of doing this??

Malcolm

EDIT: I am actually doing an MVC app if that hepls.

+3  A: 

I think the best way to do that is to replace the \r\n sequence with <br /> tags, using whatever scripting language your database-backed website is in.

Other options include placing the text within a <textarea>. Or, if it is appropriate for your site, using akin to the <pre> tag (or the CSS attribute white-space: pre).

rascher
+3  A: 

You can search/replace those characters with <br /> to make the text output with breaklines. You could also use the <pre> tag to specify a particular piece of text's line breaks.

Tony k