Subject: | Parse error on files that contain ’ |
Class::CSV cannot correctly parse files that contain a '’' character.
For example the following file is not parsed correctly:
"A","B","C"
"Foo",1,"A’s"
To reproduce unzip the attached file and run the script ./csv_file_parse.pl
Expected result:
Parsed file successfully
Actual Result:
dlarochelle@dlarochelle-laptop:~/librarylab/npr_scrape/class_csv_bug$
./csv_file_parse.pl
Unused variable my $csv at ./csv_file_parse.pl line 15.
Failed to parse line: "Foo",1,"A’s"
at /usr/local/share/perl/5.10.1/Class/CSV.pm line 232
Class::CSV::Line::_do_parse('Class::CSV::Line=HASH(0x9a32f90)',
'"Foo",1,"A\x{e2}\x{80}\x{99}s"') called at
/usr/local/share/perl/5.10.1/Class/CSV.pm line 182
Class::CSV::Line::new('Class::CSV::Line', 'fields', 'ARRAY(0x9a14818)',
'csv_xs_options', 'Class::CSV::CSV_XS_Options=HASH(0x9a2f480)', 'line',
'"Foo",1,"A\x{e2}\x{80}\x{99}s"') called at
/usr/local/share/perl/5.10.1/Class/CSV.pm line 390
Class::CSV::new_line('Class::CSV=HASH(0x9b0d748)', undef,
'HASH(0x9b1f7c0)') called at /usr/local/share/perl/5.10.1/Class/CSV.pm
line 358
Class::CSV::_do_parse('Class::CSV=HASH(0x9b0d748)', 'fields',
'ARRAY(0x9a14818)', 'filename', 'parse_error.csv') called at
/usr/local/share/perl/5.10.1/Class/CSV.pm line 316
Class::CSV::parse('Class::CSV', 'filename', 'parse_error.csv',
'fields', 'ARRAY(0x9a14818)') called at ./csv_file_parse.pl line 15
main::main() called at ./csv_file_parse.pl line 23
Subject: | class_csv_bug.tgz |
Message body not shown because it is not plain text.