From: Tara L Andrews Date: Sat, 21 Jan 2012 23:43:11 +0000 (+0100) Subject: no quoting needed for tabsep files X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=97a52a67485bb7643fcc63d43137d5934cd7567d;p=scpubgit%2Fstemmatology.git no quoting needed for tabsep files --- diff --git a/lib/Text/Tradition/Parser/Tabular.pm b/lib/Text/Tradition/Parser/Tabular.pm index bf2e077..cdd1804 100644 --- a/lib/Text/Tradition/Parser/Tabular.pm +++ b/lib/Text/Tradition/Parser/Tabular.pm @@ -115,10 +115,13 @@ foreach my $k ( keys %seen_wits ) { sub parse { my( $tradition, $opts ) = @_; my $c = $tradition->collation; # shorthand - my $csv = Text::CSV_XS->new( { - binary => 1, # binary for UTF-8 - sep_char => exists $opts->{'sep_char'} ? $opts->{'sep_char'} : "\t" } - ); + my $csv_options = { 'binary' => 1 }; + $csv_options->{'sep_char'} = $opts->{'sep_char'} || "\t"; + if( $csv_options->{'sep_char'} eq "\t" ) { + # If it is really tab separated, nothing is an escape char. + $csv_options->{'quote_char'} = undef; + } + my $csv = Text::CSV_XS->new( $csv_options ); my $alignment_table; if( exists $opts->{'string' } ) {