+2  A: 

Have you tried adding a xml:space="preserve" attribute and use just plain normal line breaks?

Lucero
+1. Using xml:space gives better fidelity to the content.
AnthonyWJones
I tried that now but unfortunately it doesn't work. I store the comment in a mysql-database (after using the php function mysql_real_escape_string() to make it safe) and then retrieve it from the database to display it. Maybe the problem lies here?
aspartame
+2  A: 

Why not use regular linebreaks? Those work just fine.

If you want <br /> to appear, you need to encode those entities:

&lt;br /&gt;
altCognito
+1  A: 

From the DTD:

<!ELEMENT TEXTAREA - - (#PCDATA) -- multi-line text field -->

In the XHTML code of your page, a <textarea> can only contain text (#PCDATA), and you cannot nest any XHTML elements within the <textarea>.

Your questions seems to show two different things. The image shows "<br />" written into a <textarea>, while the message from the W3C Validator is referring to a <br /> element written into the XHTML of your page within the <textarea> element.

In the first case, having "Test<br />line break" appear to the user in the text area is done by using the appropriate entities, just as altCognito wrote:

<textarea>Test&lt;br /&gt;line break</textarea>

Anything that's being entered by the user that is then redisplayed within a <textarea> on a new page should be encoded (i.e., use entities for &, ", ', <, and >).

If want to display a user's entry:

Test<br />line break

...as...

Test
line break

...within another text area, then you will need to parse what has been entered into the original <textarea> and replace the user-entered <br />s with normal line breaks. See Lucero's answer.

David Kolar