in reply to Parsing MS SQL CSV export with Text::CSV_XS
If you suspect errors, don't use ->status (), but ->error_diag ().
If you expect weird characters, you can use my new module Data::Peek:
use Text::CSV_XS; use Data::Peek; my $csv = Text::CSV_XS->new ({ binary => 1 }); $csv->parse (qq{"ab\nc\x{20ac}\x80"}); print DPeek, "\n" for $csv->fields; $csv->parse (qq{"ab\nc\x{20ac}\x80",\r"\n}); $csv->error_diag;
Will return
PV("ab\nc\342\202\254\302\200"\0) [UTF8 "ab\nc\x{20ac}\x{80}"] # CSV_XS ERROR: 2031 - EIF - CR char is first char of field, not part +of EOL
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing MS SQL CSV export with Text::CSV_XS
by andyford (Curate) on Oct 22, 2008 at 20:04 UTC |