csv

P

Peter Kirk

Hi

I am writing some code to generate csv from xml. This works fine in the
main, but I have a question regarding the handling of commas in the data.
What is the normal way to handle this?

For example, say part of the data in the xml is the string "a string , with
comma". The comma is confusing in the csv.

Likewise, when I generate the xml (which is then turned into csv) a double
value is written to the xml as the string "17,2" for example - as we are
running under Danish-culture. The comma here also confuses the csv.

Are there any general guidelines for handling these sorts of situations in
csv? We have thought about a semicolon as seperator instead, but then what
if data strings contain this character.....?

Thanks,
Peter
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

You have to escape the "," that is part of a value.

Go to opennetcf.org they have a csv data provider and you can see/use the
parser.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top