What have I done now ? (aka CR and LF confusion)
brian at milby7.com
Wed May 27 22:15:22 EDT 2020
You need to use binfile on Mac to get sane line endings. I have a PR to fix, but doubt it will get merged.
On Mac/Windows, file will convert line endings to what LC thinks is the native one for the OS. CRLF for Windows and CR for Mac (the real CR, not the one that LC uses internally where CR and LF are synonyms for LF). So on Linux you can use either file or binfile, on Windows you need to use file, and on Mac you need to use binfile to get the currently expected line endings.
On May 27, 2020, 9:24 PM -0400, Alex Tweedly via use-livecode <use-livecode at lists.runrev.com>, wrote:
> I don't know if I've done something to my LC prefs, or to my Mac, or to
> myself :-)
> the following script
> > on mouseUp
> > local t
> > put "asd" & CR & "qwe" & CR & "zxc" &CR into t
> > put t into URL ("file:/Users/alextweedly/tiny.txt")
> > end mouseUp
> does create a file - but that file can't be (easily, properly) used by
> some other Mac apps, because all the end-of-line characters are 0x0d
> (i.e. numtochar(13)). So unix utilities like wc, cat, grep, more, ...
> won't deal with it properly - though emacs, Sublime, Coda2, etc. do ok.
> If I create the same file in an editor (emacs, Sublime Text, ...) they
> all produce e-o-l characters which are 0x0A (i.e. numtochar(10)), and
> this works in both editors and utilities mentioned above, as well as LC.
> Maybe it's always been like this ??
> I don't know - I just noticed because I tried to 'grep' for some
> characters in all files within a folder, and didn't find anything
> (though I should have done).
> SO I can get by - just avoid using any files created within LC with any
> other apps - but I'd rather find out if I should be doing something
> different, or if I've accidentally changed some setting that causes this.
> Thanks for any thoughts,
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode