Because it's so natural and computers do it!
Why do people write the answer before the question?
Davor said:
No, it's not like pre. Text is inserted in textarea and saved in
database and it's in one long line whereever the line is broken by
textarea automatically. But I stil want to keep users entered
crlf-s and multiple spaces.
You should have explained that in the original question. It changes the
whole issue.
In processing user input from textarea, you can't assume much, since
browsers behave in different ways
(see
http://www.cs.tut.fi/~jkorpela/forms/textarea.html ).
You _do_ get spaces as entered by the user. What you do then depends on
the context. If the data is echoed to a user in an HTML document, then
the <pre> element takes care of preserving spaces. Replacing spaces by
generally works, though it's really a hack and not guaranteed to
work.
Line breaks are a different beast. You might be unable to distinguish
user-entered line breaks from browser-generated line breaks ("hard
wrapping"), and more seriously you cannot know whether the user
actually _meant_ to break a line but didn't - because he saw the
browser wrap the text and thought that's OK (without realizing that the
line break will probably not be transmitted).
What you really need now is an analysis of what you are doing with the
user data and why.