Re-2: Removing CRLF from text
kray at sonsothunder.com
Thu Aug 7 11:34:31 EDT 2008
> Weird again. I have learned more things today that I wished I did not. I
> wonder why it's implemented this way.
Actually IIRC, it's done this way to standardize *internal* interpretation
on all the platforms (much like Rev standardizes on forward slash for path
delimiters). That way, regardless of whether the host OS uses LF only, CR
only or CRLF, when text data is read in from the outside it is all converted
internally to use the LF character (ASCII 10). If you want to read in the
actual end-of-line (EOL) delimiters, you can read the file in *as binary*:
put url ("file:myfilePath") into tVar -- EOLs are now all LFs
put url ("binfile:myfilePath") into tVar -- EOLs are all preserved
As to why LF was standardized as the internal representation? Well, I would
have to assume it's from Rev's roots - originally it was called MetaCard and
was developed for UNIX only... over time it migrated to the Windows and then
Mac platforms, and eventually became Revolution. And back in those days, the
LF char was used for the EOL character (although nowadays I think Linux
supports LF and CRLF, but I'm not sure).
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
More information about the use-livecode