Saving linebreaks in a TEXT field

  • Follow


So I have my database and I read text from a webpage then put it in a record 
including a field that is dataype TEXT.

Of course I lose line breaks, so what happens is that the following 
sentence:

This is line 1...

.... and this is line 2

becomes "This is line 1... ... and this is line2"

Is there some function I can call in Perl or something else I can do so I 
store and keep the format of the text?

Many thanks.... 


0
Reply Daniel 10/25/2007 1:36:55 AM

Daniel Kaplan wrote:
> So I have my database and I read text from a webpage then put it in a record 
> including a field that is dataype TEXT.
> 
> Of course I lose line breaks, so what happens is that the following 
> sentence:
> 
> This is line 1...
> 
> ... and this is line 2
> 
> becomes "This is line 1... ... and this is line2"
> 
> Is there some function I can call in Perl or something else I can do so I 
> store and keep the format of the text?
> 
> Many thanks.... 
> 
> 
> 

Look at the source for your web page.  I suspect your line breaks are 
there, and your problem is that HTML ignores them.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

0
Reply Jerry 10/25/2007 3:21:56 AM


"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message 
news:vcudnX6Mb7d1lr3anZ2dnUVZ_qHinZ2d@comcast.com...


> Look at the source for your web page.  I suspect your line breaks are 
> there, and your problem is that HTML ignores them.


you make a good point, but then it comes to me finding them before i put 
them in the DB, then converting them to <P> and <BR>, no?

off the top of your head, do you know what they are in the edit field when i 
read it?  \n? \r?

thanks 


0
Reply Daniel 10/25/2007 3:47:05 AM

On 25 Oct, 04:47, "Daniel Kaplan" <NoS...@NoSpam.com> wrote:
> "Jerry Stuckle" <jstuck...@attglobal.net> wrote in message
>
> news:vcudnX6Mb7d1lr3anZ2dnUVZ_qHinZ2d@comcast.com...
>
> > Look at the source for your web page.  I suspect your line breaks are
> > there, and your problem is that HTML ignores them.
>
> you make a good point, but then it comes to me finding them before i put
> them in the DB, then converting them to <P> and <BR>, no?
>
> off the top of your head, do you know what they are in the edit field when i
> read it?  \n? \r?
>
> thanks

Depends, how are you "read[ing your] text from a webpage"?

0
Reply Captain 10/25/2007 8:36:59 AM

Daniel Kaplan wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message 
> news:vcudnX6Mb7d1lr3anZ2dnUVZ_qHinZ2d@comcast.com...
> 
> 
>> Look at the source for your web page.  I suspect your line breaks are 
>> there, and your problem is that HTML ignores them.
> 
> 
> you make a good point, but then it comes to me finding them before i put 
> them in the DB, then converting them to <P> and <BR>, no?
> 
> off the top of your head, do you know what they are in the edit field when i 
> read it?  \n? \r?
> 
> thanks 
> 
> 
> 

Nope, you shouldn't be storing html commands in hour database.  What if, 
for instance, you decide you need to access it from a non-web based 
environment, i.e. a command-line utility to generate some reports?

The formatting should be done after you retrieve the data form the 
database, not before.

For the rest, try a programming group for the language you're using.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

0
Reply Jerry 10/25/2007 1:23:48 PM

4 Replies
252 Views

(page loaded in 0.091 seconds)

Similiar Articles:













7/29/2012 2:53:03 AM


Reply: