in reply to problem with csv parsing
This removes the error.
#!/usr/bin/env perl use strict; use warnings; use Text::CSV; my $fileTable = shift; my $codepage = 'utf8'; my $CSV_H = Text::CSV->new ( { sep_char => ";", binary => 1, blank_is_undef => 1, empty_is_undef => 1, allow_whitespace => 0, quote_char => undef } ); if (open my $TBL_H, "<:encoding($codepage)", $fileTable) { while (my $row = $CSV_H->getline ($TBL_H)) { } $CSV_H->eof or $CSV_H->error_diag (); close $TBL_H; }
If your input is, as you say, not completely valid then you will have to consider the possibility that further problems may arise. Pre-processing the input into a valid form might be a good idea.
PS. Are you sure your input is really utf8?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: problem with csv parsing
by igoryonya (Pilgrim) on May 20, 2020 at 12:42 UTC | |
|
Re^2: problem with csv parsing
by igoryonya (Pilgrim) on May 21, 2020 at 03:02 UTC | |
by Tux (Canon) on May 21, 2020 at 08:46 UTC | |
by hippo (Archbishop) on May 21, 2020 at 08:15 UTC | |
by igoryonya (Pilgrim) on May 21, 2020 at 12:32 UTC |