reading win and mac text files on linux

Martin Baxter martin at materiaprima.fsnet.co.uk
Sat Apr 17 15:11:40 EDT 2004


>Martin Baxter wrote:
>> For quite a while now I've been moving a large set
>> of plain text data files back and forth between mac
> > and windows and revolution has read and written
>> them seamlessly on either platform, regardless of
>> the line end characters in the files it opens.
> > (I'm just using "put into url x", and "put url x
>> into", with the "file:" protocol.)
>>
>> Recently I moved these data files to Linux, read
>> them into revolution and was surprised that no
> > automatic conversion of line endings seems to be done
>> when opening them on that platform. The Mac text
>> files opened into revolution as a single line with
> > a sprinkling of ascii 13s, and the PC files all have
> > a spare ascii 13 at the end of each line.
>>
>> I expected line endings to be converted
>

>  Richard Gaskin:
>I had the impression that using this:
>
>   get url ("file:"&tMyPath)
>
>....would translate line endings unless the URL is remote (i.e., using
>"http" instead of "file").  It might be good to check that against older
>versions of the engine and the docs to ensure it's not a a bug.
>

You had the same impression as me then Richard, but I think perhaps I've
figured out what's happening, and have posted a "theory" separately.

>This may work well:
>
>   open file tMyPath for text read
>   read from file tMyPath until EOF
>   close file tMyPath
>

I will try this later, I'm curious to see how it behaves.

Martin Baxter









More information about the use-livecode mailing list