Re: csv (comma separated value) file



On Mon, 3 Aug 2009, Paolo Bacchilega <paolo bacchilega libero it> wrote :
it's not so easy, for example the following csv file:

"a;b";c

has only two columns, you cannot handle this case with a simple g_strsplit call

And for extra fun, I've recently had to handle a CSV format where the first line was:
CSV version 2,.,*,",
when generated in the UK and:
CSV version 2;,;*;";
when generated by our Italian customer. And yes, that does mean that the Italian version used ; as the separator and , for the decimal place, rather than , for the separator and . for the decimal. It also means that both versions use " for quoting, and a line beginning with * is a comment. The tool reading this file is expected to deduce the correct format from that first line.
--
Rob Pearce                       http://www.bdt-home.demon.co.uk

The contents of this | Windows NT crashed.
message are purely   | I am the Blue Screen of Death.
my opinion. Don't    | No one hears your screams.
believe a word.      |


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]