multiline CSV records (comma-separated values format)

Discussion in 'Perl Misc' started by Yakov, Apr 25, 2007.

  1. Yakov

    Yakov Guest

    Which CVS parser on cpan supports multiline CSV fields/records ?
    Searching for CSV modules on cpan, I get impression that most of
    them do not suport multiline values.
    Which cvs parser support multiline fields ?

    I have cvs data from my pda, and lots of records contain multiline
    fields.

    Thanks
    Yakov
     
    Yakov, Apr 25, 2007
    #1
    1. Advertising

  2. Yakov

    Mumia W. Guest

    On 04/25/2007 10:28 AM, Yakov wrote:
    > Which CVS parser on cpan supports multiline CSV fields/records ?
    > Searching for CSV modules on cpan, I get impression that most of
    > them do not suport multiline values.
    > Which cvs parser support multiline fields ?
    >
    > I have cvs data from my pda, and lots of records contain multiline
    > fields.
    >
    > Thanks
    > Yakov
    >


    Text::CSV_XS supports multiline values if you use the 'binary' option.
     
    Mumia W., Apr 25, 2007
    #2
    1. Advertising

  3. Yakov

    Yakov Guest

    On Apr 25, 7:43 pm, Purl Gurl <> wrote:
    > Yakov wrote:
    > > Which CVS parser on cpan supportsmultilineCSVfields/records ?
    > > Searching forCSVmodules on cpan, I get impression that most of
    > > them do not suportmultilinevalues.

    >
    > Clearly there exists a delimiter between records, even if
    > records span multiple lines.


    In multiline CSV, odd number of double-quotes in the record signals
    the unfinished record.
    This is how multiline CSV works. The record delimiter in multiline
    CSV is \n, same as in
    single-line CSV. Remotely like in multiline "..." perl string, newline
    is just embedded into double-quoted csv field (except that ["] is
    escaped by doubling it rather than turning it into \").
    In multiline CSV, \n is also end of CSV record, and also the eof
    embedded in the csv field.

    Here is example of one csv record containing 2 fields, each being
    multiline:

    "first line of field 1 record 1...
    second line of field 1 record 1","first line of field 2 record 1...
    second line of field 2 record 1"


    Yakov
     
    Yakov, May 12, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Miles
    Replies:
    1
    Views:
    619
    J├╝rgen Exner
    May 28, 2004
  2. Peter Rilling

    Array to a comma Separated String

    Peter Rilling, Jul 8, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    528
  3. DrLovely@.
    Replies:
    7
    Views:
    512
    DrLovely@.
    Mar 25, 2005
  4. RogerTBrick
    Replies:
    3
    Views:
    4,246
    RogerTBrick
    Mar 7, 2005
  5. hu8
    Replies:
    5
    Views:
    269
    Stefan Lang
    Jan 31, 2005
Loading...

Share This Page