1

I'm sure there must be a lot of posts answering my query, but I am just not able to find the correct post.

In my application user is entering free from description in the text area. but when data is saved and displayed on the next page, entire text is wrapped in to single para. I want whole text to be saved as user enters it along with line spaces and newlines, tabs etc.

please redirect me to correct post. Do i have to save textarea as blob?

Thanks

Sachin
  • 449
  • 2
  • 9
  • 27

1 Answers1

1

Your problem is that the text is entered in plain text, however, in HTML, extra spaces are removed, and all sorts of space are just displayed as a single space character. You have to either display the text in a <pre></pre> tag (ugly way) or reformat it using regular expression or other string processing methods to make an actual HTML.

Milad Naseri
  • 4,053
  • 1
  • 27
  • 39
  • i replaced '\n' with '
    ' while rendering HTML and problem solved.
    – Sachin Nov 04 '12 at 23:33
  • That falls into the category of "reformating it using regular expression or other string processing methods to make an actual HTML". I'm happy that your problem is now solved. – Milad Naseri Nov 05 '12 at 05:19