CR vs CRLF for end of line in text files

I’ve pretty much already solved this for my situation but have a question.

First, let me set the stage here as there’s all sorts of discussions on the web about this type of thing.

I write to a text file from my XoJo App using my Mac using the TextOutputStream and Writeline. I can read it in just fine. The Mac and Linux seem to just need a LF for the end of line marker. Windows wants the CRLF for end of line marker.

I can read the file in just fine on MacOS and Linux. Windows didn’t like it and only got the first line.

My solution was to add a CR to the end of each string before I send it to Writeline. After I did this, I was able to easily read the file on MacOS, Linux and Windows with no noticeable issues.

To avoid a zillion what if scenarios, this particular file output is really only intended be used with this XoJo app, but Libre offfice has no issue reading it either. The main goal here is to write out this simple text file so it can easily be used with the 3 mentioned OSs. And as I’ve indicated, my solution appears to work just fine without any known ill affects. Anyway, it seems when I write it out using CRLF everyone is happy.

Since I’m not taking this file to anything else, is there something I should be concerned about?


1 Like

The TextOutputStream class has a Delimiter property that allows you to set which EoL sequence to use:

Dim tos As TextOutputStream = TextOutputStream.Open(someFile)
tos.Delimiter = EndOfLine.Windows

I should use that instead of tagging on to the end of the string, that was actually a quick test. Aside from that, the real question was is there any known issues I should be concerned about given my scenario :slight_smile: