5

モジュールを使用してText::CSV、タブ区切りの値ファイルから行をさまざまなフィールドに解析しています。

文字列内の特殊文字の例は次のとおりです。

"CEZARY Å?UKASZEWICZ, PAWEÅ? WIETESKA","BÜRO FÜR"

私のコードは次のようになります。

my $file = $ARGV[0] or die "Need to get TSV file on the command line\n";

my $csv = Text::CSV->new({sep_char => "\t"});

open(my $data,'<', $file) or die "Could not open '$file' $!\n";


while (my $line= <$data>) {

       if($csv->parse($line)){
            my @curr_arr = $csv->fields();

        }
} # end of while

close $data;

上記は、私のコードの重要な部分の一部です。私が得るエラーは次のとおりです。

cvs_xs error : 2026 - EIQ - Binary Character inside quoted field, binary off @pos 15
4

1 に答える 1

11
my $csv = Text::CSV->new({ binary => 1, sep_char => "\t"});
于 2013-01-09T22:31:21.013 に答える