cr, lf, and reading in terminals/vim

Bob Sneidar bobsneidar at iotecdigital.com
Thu Oct 31 10:41:33 EDT 2019


Not to disagree, but just to mention this is not exclusive to LC. If I download the address book of a Toshiba copier, then just OPEN it with Microsoft Office ot TextEdit, then close without saving, I can no longer import that file into the copier again. 

Upon examining the ascii value of every line terminator I discovered something, perhaps the OS or the software itself, converted the terminators to something else. I also find this practice to be not just confusing, but reprehensible. I'm sure it was done as an easy fix to some other text display problem, but developers have no license to change the data in a file without the user's knowledge and approval. 

That being said, I also use open binary for write to get around this limitation. As long as I don't put data into a text field as temporary storage, in other words just memory, then the line endings are preserved no matter what OS I run on. 

Bob S


> On Oct 30, 2019, at 19:27 , Richard Gaskin via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Brian Milby wrote:
> 
> > The reason for the difficulty is that internally LC uses LF as the
> > line ending.  The cr, lf, and return constants all actually map to LF.
> > When you write a text file, LC will convert line endings to the native
> > format.  So for Windows you get CRLF, Linux gets LF, and Mac gets CR.
> > I take issue with this because as of OS X the native line ending for
> > the OS is actually now LF...
> 
> Agreed.
> 
> The hard question is: What shall we do about it?
> 
> On the one hand, we have millions of lines of code in our community that use CR, and a certain percentage of those are dependent on CR having a specific value (even if that value is inconsistent with the true ASCII value).
> 
> On the other hand, we have a constant that suggests it's one thing when it's really something else, and at this point that design decision benefits no one and confuses many.
> 
> Favor backward compatibility, or language learnability/usability?
> 
> -- 
> Richard Gaskin





More information about the use-livecode mailing list