csv

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Kirk

    csv

    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


  • Peter Kirk

    #2
    Re: csv


    "Peter Kirk" <pk@alpha-solutions.dk> skrev i en meddelelse
    news:O5%23lIotj GHA.4044@TK2MSF TNGP03.phx.gbl. ..[color=blue]
    > 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?[/color]

    So I found this:


    Thanks,
    Peter


    Comment

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

      #3
      Re: csv

      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.


      --
      --
      Ignacio Machin,
      ignacio.machin AT dot.state.fl.us
      Florida Department Of Transportation


      "Peter Kirk" <pk@alpha-solutions.dk> wrote in message
      news:O5%23lIotj GHA.4044@TK2MSF TNGP03.phx.gbl. ..[color=blue]
      > 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
      >[/color]


      Comment

      Working...