Here is the JavaScript solution I just wrote based on the method shown here :
function getListSeparator() { var list = ['a', 'b'], str; if (list.toLocaleString) { str = list.toLocaleString(); if (str.indexOf(';') > 0 && str.indexOf(',') == -1) { return ';'; } } return ','; }
The key is in the toLocaleString () method, which uses the system list separator.
You can use JavaScript to get the list separator and set it in a cookie that you might find from your server.
I checked all Windows locales, and it seems that the default list separator is almost always either ",", or ";". For some locales, the drop-down list on the control panel offers both options; for others, he offers only ",". One language, Divehi, has a strange character that I have not seen before as a list separator, and for any locale the user can enter any line that they want as a list separator.
Putting random strings as a separator in a CSV file sounds like a problem to me, so my function above will return either ';' or '.' and it will only return ';' if he cannot find the string ',' in the string Array.toLocaleString. I'm not quite sure if the .toLocaleString array has the format that is guaranteed in browsers, so indexOf checks and does not highlight a character with a specific index.
Using Array.toLocaleString to get a list separator works on IE6, IE7 and IE8, but unfortunately it doesn't work on Firefox, Safari, Opera and Chrome (or at least the versions of these browsers on my computer): all of them, seem to separate the elements of the array with a comma, regardless of the setting of the "Windows List Separator".
It is also worth noting that by default, Excel seems to use the "decimal separator" system when parsing numbers from CSV files. SK. So, if you localize the list separator, you can also localize the decimal separator.