我正在使用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
答案 0 :(得分:11)
my $csv = Text::CSV->new({ binary => 1, sep_char => "\t"});