reading win and mac text files on linux
Martin Baxter
martin at materiaprima.fsnet.co.uk
Sat Apr 17 17:25:21 EDT 2004
>>Martin Baxter wrote:
>> 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.
>
>This may work well:
>
> open file tMyPath for text read
> read from file tMyPath until EOF
> close file tMyPath
>
For the record, this apparently behaves exactly the same as:
put url "file:"&tMyPath into y
at least so far as converting line-endings is concerned.
i.e. on Mac and Windows, all possible line endings are automatically
converted, but on Linux (and presumably all Unixes) there is no conversion.
I now suspect this is a legacy issue rather than by design. When Metacard
added support for non-Unix platforms, the non-LF line-endings would have
had to be catered for. But changing the existing routines, originally aimed
at The Unix platform only, would have broken existing user-code, hence the
apparent anomaly. - Just a guess.
Martin Baxter
More information about the use-livecode
mailing list