Basically, if you're coming from access, a linefeed is a chr(10) followed by
a chr(13). I throw away the chr(13) because the chr(10) is enough to tell
all systems that there is a linebreak there. Of course, the browser sees
the linebreak but doesn't render it because it ignores excess whitespace.
Mostly I clean this up because I generally have data coming from wierd
sources -- like FileMaker for the Macintosh via MS-SQL 2000. The chr(10) is
(almost) always there (if not, it uses a vertical tab) but the chr(13) is
sometimes there and sometimes not, so I just remove any instances of it.
So then we need to replace the linebreak which is now just chr(10) with a
<br> tag and a linebreak so that the breaks will render.
What we end up with in code looks something like
output = replace(replace(string, chr(13), ''), chr(10), '#chr(10)#<br>');
So you might have something on your CF page that looks like the following:
<cfoutput query="AccessQuery">
#replace(replace(memofield, chr(13), ''), chr(10), '#chr(10)#<br>')#
</cfoutput>
Does that make more sense?
--Ben Doom
Programmer & General Lackey
Moonbow Software
: -----Original Message-----
: From: Russ [mailto:russ@;unrealisticexpectations.com]
: Sent: Monday, November 11, 2002 9:29 PM
: To: CF-Talk
: Subject: RE: Retrieving CRs from the database
:
:
: Ben--
:
: I don't think I understand how I could do this--I'd need to do it to
: content that's being dumped into a memo field and then live to the page.
: I've never had to throw something like this together, so I don't grasp
: what you're telling me to do.
:
: Thanks,
:
: Russ
:
: > -----Original Message-----
: > From: Ben Doom [mailto:bdoom@;moonbow.com]
: > Sent: Monday, November 11, 2002 4:14 PM
: > To: CF-Talk
: > Subject: RE: Retrieving CRs from the database
: >
: >
: > I've done something similar from forms.
: >
: > Basically, I use one replace to remove all the chr(13)'s,
: > then replace all chr(10)'s with <br>#chr(10)#.
: >
: >
: > --Ben Doom
: > Programmer & General Lackey
: > Moonbow Software
: >
: > : -----Original Message-----
: > : From: Russ [mailto:russ@;unrealisticexpectations.com]
: > : Sent: Monday, November 11, 2002 3:30 PM
: > : To: CF-Talk
: > : Subject: Retrieving CRs from the database
: > :
: > :
: > : I'm pulling content from my database that has been inputted
: > via a form.
: > : When I output as HTML, well, let's just say I don't want to do that.
: > :
: > : Instead, I'd like to understand how to recognize a CR from
: > the database
: > : and treat it as a <BR> or <P> as necessary.
: > :
: > : Has anyone worked on this or can give me some advice as to how to
: > : perform?
: > :
: > : Thanks,
: > :
: > : Russ
: > :
: > :
: >
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com