Write text file not correct in Windows

I have a method that exports text:

var fileNameSuggestion = forms.users_general.users_to_current_users.usr_temp_path + '/Text.txt'
var textData= "text1\ntext2"
var success = plugins.file.writeTXTFile(fileNameSuggestion,textData)

It works fine on the mac but if I run it on Windows i get strange squares instead of returns. I’ve tried also to replace \n with \r, but it doesn’t help.

What am I doing wrong? :shock:

I think on Windows you need \r\n, because Windows handles this differently… But I think you only see the squares because you use a very low level text editor to look at the result…

I agree with Patrick on the ASCII 13 and ASCII 10 pair (\r\n) for Windows.

I have also found that some Windows programs will show squares with this pairing (and want only \n). Opening your output file in a low level file editor (e.g. - EditPad Pro or facsimile) and comparing to a file that is “working” (ie - does not show the squares) can also help discern the required pattern for the target application/system.

M/