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

Report information
The Basics
Id:
115953
Status:
resolved
Priority:
Low/Low
Queue:

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

BugTracker
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!


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.