Line feed getting lost in .txt files

I am generating a text file on Xojo cloud.

I can download and open the text file on my mac just fine.

Windows users report the the line feeds are getting lost.

How does one create a text file that can be used in both mac in windows from Xojo Cloud.

[quote=208759:@Jay Menna]I am generating a text file on Xojo cloud.

I can download and open the text file on my mac just fine.

Windows users report the the line feeds are getting lost.

How does one create a text file that can be used in both mac in windows from Xojo Cloud.[/quote]

Use ReplaceLineEndings on Windows so the text uses EndOfLine.Windows.

The example of the LR is exactly what you should do.

Do you know what kind of machine they are going to open the txt file on ?
Do they make a request to your web app that causes the file to be generated ?
If so use that information to write either EndOfLine.Windows or EndOfLine.OSX to the text file

If you just use EndOfLine and the machine is running on linux then you get Unix line endings which Windows doesn’t treat as line endings

It is not possible to know what kind of machine will be used.

Perhaps TXT is not the right format to store this… HTML Perhaps?

Can you offer the user the option to choose for themselves?

Windows expects EndOfLine to be Chr(13)+Chr(10). Mac TXT files use only CHR(13).

Generate your files with EndOfLine.Windows, and both Mac and Windows will open them fine.

[quote=208772:@Jay Menna]It is not possible to know what kind of machine will be used.
Perhaps TXT is not the right format to store this… HTML Perhaps?[/quote]
If its part of "press a button the app generates the text file & then it downloads it immediately ?
The session should know if they are on a mac windows pc, etc and you could use that

But if its something your app generates with out such a request using the Windows line endings may suffice as many Mac apps will open that and translate them

What applications are they opening the files in ?
That might be useful to know as that may open other alternatives

The xojo web app send email to users who never touch the web app.

The Mail is then archived of to a drive and put in a little folder as a .txt file.

Any number of government then download are read the .txt file.

The may be on a mac, they my be on a PC. Perhaps even some odd flavor of Linux

Well then you’re in a tough spot since you dont know who is going to open it in what software or what platform.
Write Windows lines endings and hope Mac and Linux users have software that will auto translate those to their native ones is probably the best you can hope for.

However, those users may say that lines are double spaced :stuck_out_tongue:

Next question - does it have to be a TEXT file ?
A PDF at least is cross platform & renders the same on all and you dont have to worry about line ending style.
Or an RTF which again is cross platform
But both of those require using software that can open them

And if its the kind of thing that people open & alter then save well … thats a new twist

I have never seen a Mac program getting Windows Text as double space since the System 9 or so. Besides, Windows text format is the de facto standard, and one would expect that format to be widely used in government.

Count yourself lucky then
I have
Write an app using Xojo and forget to replacelineendings when you read the data you get that effect in xojo
I have others that behave that way as well
An app like BBEdit will , if you have “translate line endings off”, not turn it into 2 lines but it turns it into one line + what appears to be a space (since its CR LF)
Textedit doesn’t have an option & always translates line endings

Just dont be surprised if it happens

[quote=211571:@Norman Palardy]Count yourself lucky then
I have
Write an app using Xojo and forget to replacelineendings when you read the data you get that effect in xojo
I have others that behave that way as well
An app like BBEdit will , if you have “translate line endings off”, not turn it into 2 lines but it turns it into one line + what appears to be a space (since its CR LF)
Textedit doesn’t have an option & always translates line endings

Just dont be surprised if it happens[/quote]

I did not say it was impossible. I was referring to the standards apps precisely like TextEdit, Pages, etc. All the case you cited are not exactly user’s run of the mill.

Many apps will auto translate - I didn’t disagree there
I was just pointing out there are those that won’t because it may not be the right thing to do
BBEdit isnt exactly an unknown app

[quote=211575:@Norman Palardy]Many apps will auto translate - I didn’t disagree there
I was just pointing out there are those that won’t because it may not be the right thing to do
BBEdit isnt exactly an unknown app[/quote]

Users <> Developers. BBEdit or Xojo are not really the kind of apps that will be used in the setting described by the OP.

My point was about regular users. Not power ones and even less programmers.

Apple has worked real well at making sure Windows originated files can be opened transparently by regular users. I open daily Windows documents with Pages or Numbers, and it is really good.

You dont need to be a programmer to use BBEdit or one of Barebones other tools
Web designer maybe

Pages does
But there are apps that dont that are used by non-programmer types

That’s all I’m saying