Windows vs Linux CSV export uses different separators by default

I’ve noticed that on Linux when exporting data using Sao the separator is set to a comma, which works great for me because that is what Excel and OpenOffice are expecting. However if I am using Windows the separator is set to a semi-colon, which means that if I forget to change it, I end up with the whole line in the first cell.

I know that CSV isn’t really a standard, and I understand that in many European locales a comma is used as the decimal separator, so I’m guessing that in those countries the semi-colon is probably the separator Excel expects? What I don’t understand is why the defaults in Sao are different when running on a Linux vs Windows browser? And should the default separator be dependent on the locale instead of the OS?

1 Like

This is done on purpose because on Windows normally users use Excel which won’t import the file as CSV if you use comma as separator. With this behaviour the file will be always opened by the Spreadsheet software no mather on which os is the User.

Maybe Excel had been updated and now it accepts comma as CSV separtor.
Are you using a recent version?

For me, as far as I can remember, Excel has always (since at least the late 1990’s) expected a comma as the separator. :thinking:

I think Excel decides which to use based on the “Decimal Separator” that is set for the language. From what I could find out, when the decimal separator is a full stop it expects the CSV separator to be a comma, and when the decimal separator is a comma it expects the CSV separator to be a semi-colon.

On the following Microsoft page it mentions “Comma separated values text files (.csv), in which the comma character (,) typically separates each field of text.” And near the bottom of the page it tells you “If you want to use a semi-colon as the default list separator …, consider changing the default decimal separator to a comma”.

For me I get different behaviour from Sao when using Windows and Linux, one generates comma separated exports, the other generates semi-colon separated exports. For me both Excel and OpenOffice on both Windows and Linux expect comma separated values. I’m guessing for you this is different.

1 Like

That makes sense and we should probably follow the same logic so all of our Excel users are happy :wink:

Here is the code that is causing such behaviour on sao

1 Like

It is explained in Improving CSV import/export (#5361) · Issues · Tryton / Tryton · GitLab

2 Likes