471,342 Members | 1,984 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,342 software developers and data experts.

How can i protect text format ?

Hi..
I want to do a forum with python but i have a problem..

I have a <textareaand 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 ?

Oct 23 '07 #1
4 1143
On Tue, Oct 23, 2007 at 06:30:18AM -0700, Abandoned wrote regarding How can i protect text format ?:
>
Hi..
I want to do a forum with python but i have a problem..

I have a <textareaand 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 ?

--
http://mail.python.org/mailman/listinfo/python-list
Are you sure they're getting lost on the way into the DB? Could they be getting lost on the way out? Say... into an HTML page?

You need to pinpoint your problem more clearly to get a helpful response.

Cheers,
Cliff
Oct 23 '07 #2
On Oct 23, 4:41 pm, "J. Clifford Dyer" <j...@sdf.lonestar.orgwrote:
On Tue, Oct 23, 2007 at 06:30:18AM -0700, Abandoned wrote regarding How can i protect text format ?:
Hi..
I want to do a forum with python but i have a problem..
I have a <textareaand 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 ?
--
http://mail.python.org/mailman/listinfo/python-list

Are you sure they're getting lost on the way into the DB? Could they be getting lost on the way out? Say... into an HTML page?

You need to pinpoint your problem more clearly to get a helpful response.

Cheers,
Cliff
Yes when i selected the data it have one row (there isn't \n)

Oct 23 '07 #3
On 23 Okt, 15:30, Abandoned <best...@gmail.comwrote:
Hi..
I want to do a forum with python but i have a problem..

I have a <textareaand 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

Oct 23 '07 #4
On 10/23/07, Abandoned <be*****@gmail.comwrote:
Hi..
I want to do a forum with python but i have a problem..

I have a <textareaand 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 ?
I don't think the issue has anything to do with python.

I guess while you are displaying the text into an HTML page the "\n"
characters should be replaced by "<br />" to appear as newlines.

Cheers,
--
Amit Khemka
Oct 23 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by YK | last post: by
23 posts views Thread by Luc | last post: by
2 posts views Thread by itamtodd | last post: by
12 posts views Thread by =?Utf-8?B?am9uaWdy?= | last post: by
22 posts views Thread by teejayem | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.