From: Tara L Andrews Date: Tue, 23 Apr 2013 20:57:32 +0000 (+0200) Subject: don't forget to decode the sigla in XLSX too X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fa6bc75de8d3cd0157db2e09e66249522ca220b6;p=scpubgit%2Fstemmatology.git don't forget to decode the sigla in XLSX too --- diff --git a/base/lib/Text/Tradition/Parser/Tabular.pm b/base/lib/Text/Tradition/Parser/Tabular.pm index 6d70155..365975e 100644 --- a/base/lib/Text/Tradition/Parser/Tabular.pm +++ b/base/lib/Text/Tradition/Parser/Tabular.pm @@ -68,6 +68,7 @@ an 'ante-correction' version of the 'main' witness whose sigil it shares. =begin testing +use Test::More::UTF8; use Text::Tradition; binmode STDOUT, ":utf8"; binmode STDERR, ":utf8"; @@ -163,7 +164,8 @@ my $xtx = Text::Tradition->new( is( ref( $xtx ), 'Text::Tradition', "Parsed test Excel 2007+ file" ); my %xlsx_wits; -map { $xlsx_wits{$_} = 0 } qw/ Wit1 Wit2 Wit3 /; +map { $xlsx_wits{$_} = 0 } qw/ Wit1 Wit3 /; +$xlsx_wits{"\x{531}\x{562}2"} = 0; foreach my $wit ( $xtx->witnesses ) { $xlsx_wits{$wit->sigil} = 1; } @@ -379,7 +381,10 @@ sub _alignment_from_worksheet { push( @$alignment_table, [] ); foreach my $col ( $cmin .. $cmax ) { my $cell = $sheet->get_cell( $rmin, $col ); - my $cellval = $cell ? $cell->value() : undef; + my $cellval; + if( $cell ) { + $cellval = $decode ? decode_utf8( $cell->value ) : $cell->value; + } if( $cellval ) { $sigcols{$col} = 1; push( @{$alignment_table->[0]}, $cellval ); diff --git a/base/t/data/armexample.xlsx b/base/t/data/armexample.xlsx index 28e8a53..0c06b7a 100644 Binary files a/base/t/data/armexample.xlsx and b/base/t/data/armexample.xlsx differ diff --git a/base/t/text_tradition_parser_tabular.t b/base/t/text_tradition_parser_tabular.t index e58cd49..d028f18 100644 --- a/base/t/text_tradition_parser_tabular.t +++ b/base/t/text_tradition_parser_tabular.t @@ -8,6 +8,7 @@ $| = 1; # =begin testing { +use Test::More::UTF8; use Text::Tradition; binmode STDOUT, ":utf8"; binmode STDERR, ":utf8"; @@ -103,7 +104,8 @@ my $xtx = Text::Tradition->new( is( ref( $xtx ), 'Text::Tradition', "Parsed test Excel 2007+ file" ); my %xlsx_wits; -map { $xlsx_wits{$_} = 0 } qw/ Wit1 Wit2 Wit3 /; +map { $xlsx_wits{$_} = 0 } qw/ Wit1 Wit3 /; +$xlsx_wits{"\x{531}\x{562}2"} = 0; foreach my $wit ( $xtx->witnesses ) { $xlsx_wits{$wit->sigil} = 1; }