I am writing a CSV exporter in Java that should respect the user's custom settings, especially the "List separator" to use as a delimiter.
In Windows, one can set this List separator in
Control Panel -> Regional and Language Options -> Regional Options -> Customize
I don't know about the other operating systems, but I'm pretty sure that you can change that on other OSes, too.
What is the best way to get this custom setting from the OS into Java? I am in an Eclipse RCP environment, so I might use RCP-related solutions if there is something available.
From comments of this answer:
Reading the OS-specific setting is a need I have to meet.
So what if OSs other than Windows don't have such a setting?
I suggest you read it from registry on Windows (as alluded here): Read/write to Windows Registry using Java. On other platforms just use a good default, and perhaps, at least on Unix, also support configuring it via a custom environment variable (which you document well): How can my java code read OS environment variables?.
My gut feeling that OSs universally do not have a (system-wide or user-specific) "List separator" setting may be wrong, of course, but I doubt that.
Without resorting to a platform specific solution I think that the best approach to take is going to be to allow users to specify their preference of list separator within your own application. Either in a preferences panel, a dialog box on export or via an optional command line argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With