Skip Menu |

This queue is for tickets about the Text-CSV_XS CPAN distribution.

Report information
The Basics
Id: 115953
Status: resolved
Priority: 0/
Queue: Text-CSV_XS

People
Owner: Nobody in particular
Requestors: tsibley [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.12
Fixed in: 1.24



Subject: Space stripped from middle of field value with allow_whitespace and allow_loose_quotes
Consider the following two examples where Text::CSV_PP does what I expected from the docs but Text::CSV_XS strips an internal space in the field value: $ PERL_TEXT_CSV=Text::CSV_PP perl -MText::CSV -E 'say $_->[0] for Text::CSV->new({ allow_loose_quotes => 1, allow_whitespace => 1, escape_char => "\\" })->getline(\*STDIN)' <<<'"foo "bar" baz"' foo "bar" baz $ PERL_TEXT_CSV=Text::CSV_XS perl -MText::CSV -E 'say $_->[0] for Text::CSV->new({ allow_loose_quotes => 1, allow_whitespace => 1, escape_char => "\\" })->getline(\*STDIN)' <<<'"foo "bar" baz"' foo "bar"baz
This looks like a genuine bug in allow_whitespace $ perl -MCSV -wE'say csv(in=>\q("foo "bar" baz"),allow_loose_quotes=>1,escape=>"\\")->[0][0]' foo "bar" baz $ perl -MCSV -wE'say csv(in=>\q("foo "bar" baz"),allow_loose_quotes=>1,escape=>"\\",allow_whitespace=>1)->[0][0]' foo "bar"baz I'll have a look
This looks like a genuine bug in allow_whitespace $ perl -MCSV -wE'say csv(in=>\q("foo "bar" baz"),allow_loose_quotes=>1,escape=>"\\")->[0][0]' foo "bar" baz $ perl -MCSV -wE'say csv(in=>\q("foo "bar" baz"),allow_loose_quotes=>1,escape=>"\\",allow_whitespace=>1)->[0][0]' foo "bar"baz I'll have a look
Interesting fact is that I did NOT break that in perl6 $ perl6 -I. -Ilib -MText::CSV -e'dd csv(in=>"test2.csv",:allow_loose_quotes,escape=>"\\",:allow_whitespace)' Array @in = [["foo \"bar\" baz"],] $ perl6 -I. -Ilib -MText::CSV -e'dd csv(in=>"test2.csv",:allow_loose_quotes,escape=>"\\")' Array @in = [["foo \"bar\" baz"],]
That was brain-breaker. I found a fix, which has now been pushed. Release process has started. Thanks for finding this one.
Thanks for the fix!