line endings on OS X

Bernard Devlin revolution at knowledgeworks.plus.com
Tue Apr 24 05:55:47 EDT 2007


Hi Mark, thanks for the speedy response.  I guessed that something  
like that was going on.  However, it certainly should be documented  
more clearly.  The documentation for the "file" keyword does not  
mention this at all.

Furthermore, what I find strange is that putting any of these  
characters as a line-ending produced the strange ^M when viewed using  
vi:

return
CRLF
numToChar(10)
numToChar(13)

It is really weird that one has to use binfile to write a text file.   
Also, I had the same problem using "write to file".  So, it looks  
like it is more widespread than just using the "file:" url schema.

But thank you for at least confirming that I'm not losing my sanity  
(or at least confirming that this episode is not, in itself, evidence  
of that!)  Still, I won't get back those hours lost on something as  
trivial as this.

Bernard

> Bernard, in Rev itself, numToChar(10) is used for line endings
> (showing its Unix origins), but if written to a file on a Mac, using
> URL "file:", they're translated to numToChar(13). If using URL
> "binfile:", no translation happens, so numToChar(10) is preserved.
>
> I think what you're seeing is a difference between OS X and it's Unix
> underpinnings - vi is a Unix utility, so expects NumToChar(10), but
> the mac OS uses numToChar(13).
>
> I guess the solution is to use the "binfile:' scheme. I have
> certainly found this to be necessary when writing cgi scripts in Rev.
>
> Best,
>
> Mark






More information about the use-livecode mailing list