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.
From stackoverflow
-
I think the best way to do that is to replace the
\r\nsequence 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 attributewhite-space: pre). -
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.
0 comments:
Post a Comment