Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Text::CSV

by swiftone (Curate)
on Jan 11, 2001 at 02:34 UTC ( #51003=note: print w/replies, xml ) Need Help??

in reply to Text::CSV

I to use Text::CSV quite happily. I spent forever and a day (actually, about 6 hours) trying to debug a problem with it, that was finally answered deep within the documentation. When it says:

Allowable characters within a CSV field include 0x09 (tab) and the inclusive range of 0x20 (space) through 0x7E (tilde).

It means it. In particular, if you get anything outside of this range, including any MS curly-quotes or (in my case) a single oddly out-of-range byte, it will quietly fail.

Note that it does not accept newlines inside any field either.

Replies are listed 'Best First'.
Re: Re: Text::CSV
by dilbert (Novice) on Oct 03, 2002 at 14:27 UTC
    If you use Text::CSV_XS, you can handle those characters if you turn on the 'binary' option, like this:
    use Text::CSV_XS; $csv = Text::CSV->new({binary => 1}); ... $csv->parse($_); @fields = $csv->fields();
    Really nifty if you have to parse a CSV file with French text with accented characters and newlines in it...
      Just to be nit-picky, I think that is:
      $csv = Text::CSV_XS->new({binary => 1});
      Those that pointed out that this would resolve working with text that has accents in it - I love you. I was going absolutely batty trying to deal with this text that I needed to convert to XML.

      There are some odd things afoot now, in the Villa Straylight.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://51003]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2021-11-29 09:35 GMT
Find Nodes?
    Voting Booth?

    No recent polls found