reading win and mac text files on linux

Richard Gaskin ambassador at fourthworld.com
Sat Apr 17 17:39:41 EDT 2004


Martin Baxter wrote:

>>>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.


Good catch.  I would Bugzilla that inconsistency.  When it works it's a 
great feature, and one that should ideally be available on all supported 
platforms.

-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com


More information about the use-livecode mailing list