Open WojciechMazur opened 2 years ago
I made a change where you can set the CSV delimiter to whatever char
type you'd like. It's my understanding that European CSV files are commonly ;
(semicolon) delimited for the comma-float reason? Correct me if I'm wrong.
This makes it so any invocation of something that uses the CSV format (return from JNI, .csv() methods for the energy sample objects, AsyncEnergyMonitor.writeFileCSV(), etc) will delimit by that char. So you can set it to ;
or \t
or whatever single character you want.
Just write EnergyMonitor.setCSVDelimiter(';')
at any point during your code before a call that will use it and you're set.
The default CSV delimiter remains a comma in the event that this method is never called.
This doesn't feel ideal to be honest, but it seems like consistent CSV standards with regard to comma-floats is an open problem without a straightforward solution. Let me know if this doesn't work for your case or you think something else would work better.
In case if system locale is using
,
(comma) for decimal separator JVM would not be able to correctly parse measurements received from JNI call with CSV string. It can be fixed by setting en-us locale at beginning ofenergy_stat_csv_string
and restoring it to the previous one before returning from a call, but maybe there is a better way to fix that issue.