cr, lf, and reading in terminals/vim

Brian Milby brian at milby7.com
Wed Oct 30 22:08:54 EDT 2019


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 (although most of the stuff built in will handle either LF or CR).
As a result, I always will generate my text files using binary mode,
encoded as UTF8 on the Mac.  I will read everything using file to get the
automatic conversion to LF though.  This does complicate making cross
platform code that generates text files since you have to check the OS and
either handle Windows or Mac differently.

On Wed, Oct 30, 2019 at 6:39 PM hh via use-livecode <
use-livecode at lists.runrev.com> wrote:

> In case your python file becomes a bit more complicated, you
> shouldn't use workarounds as using backspace to come to a
> binary format, because you then need exact indents (could be
> tabs).
>
> Better use (without replacing anything in mrgCmds) Matthias'
> answer to use binary write.
>
> Or the usual variant of that
> put mrgCmds into url("binfile:" & fldr & "/theCmds.py")
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list