Well I see this as a serious topic!
Thing is that in Windows, there is the Excel. And many programs have to interact with it. Excel uses the List separator locale (cell separation).
The basic problem is that “Comma Separated Values” do not work outside US (Spanish (USA)) and English because you can’t have the same list separator character as the decimal separator. So the world outside US and English (including US army that (should) follow NATO locales, decimal comma etc and ISO measures) uses ;
as list separator to separate cells in spreadsheets, not confusing it with the decimal commas.
So in general, the locale Windows settings for list separator is ;
except for English or US where list separator is ,
.
Excel has its US/English CSV inconveniences, specifically; In the default US and English settings the same character ,
is thousand separator and Excels goes nuts (cells gets screwed importing CSVs with it used). Skipping thousand separator (when it is the same as the list separator) Excel do not recognise currency cells and take them as text. Something we have to live with in US and English environments, else world wide it works fine (with ;
).
Interesting thing (funny thought) is if Java in Windows supports an NDK with Win32 library access? Because in Win32 you call
GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SLIST, pwListSeparator, 4);
I can’t find a Java solution getting a list separator?
My suggestion is using hard coded general rule, set the list separator to ;
when decimal separator is ,
else set the list separator to ,
if another character can't be found in the locale methods or settings like in Win32. Remove (don't use) thousand separators if they are the same as the list separator.
Or use tabbed text files? The only inconvenience is that Windows open by default Excel on a .csv file and Notepad on a .txt file using the ShellExecute(0, 0, pwFileName, 0, 0, SW_SHOW);.
Noticeable is that decimal separator and thousand separator exists in Java and I guess should be used:
import java.text.DecimalFormatSymbols;
new DecimalFormatSymbols().getDecimalSeparator();
new DecimalFormatSymbols().getGroupingSeparator();