Enter & Preserve UNIX linefeeds on Mac OSX
katir at hindu.org
Fri Dec 6 00:30:02 EST 2002
I recently changed procedure for uploading files to a linux server and
the sys admin is complaining that now they are "all one line" because
of the mac endlines(char(13)
Previous routine which preserved the char (10) "cr" as unix was:
in OS9 or Classic shell under Jaguar
1) generate file in Supercard where explicit "cr" characters are
introduced into the file via statements like this:
Put "cr" after theHtmlFile
at wanted line break points.
2) Process this file with apple script in Mac OS 9.2.2 and upload with
Applescripts driving Transmit...
Result: files arrive on the remote UNIX station with char(10) at the
points where "cr" was introduced into the file by supercard running
is a work in progress. but...
a) use Metacard/Revolution in OSX to read the file created in Supercard
and build a new HTML file
(by-passing the appleScript processing... which is done in xTalk now.)
b) save that file to hard drive in OSX
c) upload the file with interarchy (later to use libURL routines)
After careful testing it appears that Revolution is taking the "cr"
that was introduced into the file by Supercard and swapping it out for
char(13) when the file is saved.
put tTemplate into URL "file:index.shtml"
results in a file with no char (10) in the locations where they should
Even if I run:
replace numToChar(13) with numToChar(10) in tTemplate
just before saving... it doesn't help. If I upload the file and then
read it back into via socket to a variable with an http:download inside
Revolution and put that data into a field its shows a file with a
single line... But if I then run the above
replace numToChar(13) with numToChar(10) in fld "check HTML"
It fixes the problem and (as long as I don't save the data to disk) if
I then upload that field via libURL... the char(10) is preserved...
i.e. in that scenario the file never goes to disk.
So then, the issue is
How To Enter and Preserve char(10) line breaks on a file saved on Max
Himalayan Academy Publications
at Kauai's Hindu Monastery
katir at hindu.org
More information about the Use-livecode