[thelist] two few CF formatting function ?'s

Nathan Dintenfass nathan at changemedia.com
Sun Mar 31 12:34:01 CST 2002


Unfortunately, it is not even as simple as that.

In Windows land, CRLF is the rule.

In Unix land, just LF.

In Macintosh land, just CR.

You can read many different places this causes issues with a quick search of
google:

http://google.com/search?hl=en&q=CRLF+LF+CR+Unix+Windows+Macintosh

If you want to be really thorough, replace all CRLF [chr(13)&chr(10)] with
LF [chr(10)] and then all CR [chr(13)] with LF [chr(10)], then run your
replace with just CHR(10).

If you have CF 5 and want to use a UDF for this, it might look like:

<cfscript>
function displayFormat(str){
	//first make Windows style into Unix style
	str = replace(str,chr(13)&chr(10),chr(10),"ALL");
	//now make Macintosh style into Unix style
	str = replace(str,chr(13),chr(10),"ALL");
	//now return the text formatted in HTML
	return replace(str,chr(10),"<br />","ALL");
}
</cfscript>



> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of jon steele
> Sent: Sunday, March 31, 2002 8:58 AM
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] two few CF formatting function ?'s
>
>
> > In modern applications, there really is no "CR" that I've been able to
> > determine, at least most of the time; it's always the combination,
> > "CRLF". Stripping both the ASCII 10 and ASCII 13 characters is the only
> > way to be thorough.
>
> It's CRLF?!? All this time I have been using LFCR in my replaces...
>
> Replace(Chr(10)&Chr(13),"<p>",textFromTextArea,"all")
>
> So I should be using Chr(13)&Chr(10)?
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Greetings - send holiday greetings for Easter, Passover
> http://greetings.yahoo.com/
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
>




More information about the thelist mailing list