How can i protect text format ?

Paul Boddie paul at boddie.org.uk
Tue Oct 23 15:50:21 CEST 2007


On 23 Okt, 15:30, Abandoned <best... at gmail.com> wrote:
> Hi..
> I want to do a forum with python but i have a problem..
>
> I have a <textarea> and i write:
> line 1 hi
> line 2 how r u
>
> And then i save to this database ( colomn data type is text)
> And than it looks "line 1 hi line 2 how r u"..
> How can i protect \n characters ?

Some questions:

1. How do you extract the data from the textarea? Which Web framework/
library are you using?

2. Are you sure that the "\n" characters are missing when you extract
the data? (Printing/writing the data to a log, perhaps using the repr
function, can be very useful.)

3. How do you save the data to the database?

4. How do you view the contents in the database? If you aren't yet
viewing the contents in your application, but instead in your database
client, does your database client show "\n" characters? If your
application is showing the contents, what does the data look like
before you try and display it? (Again, writing to a log can be
useful.)

Paul




More information about the Python-list mailing list