Skip Menu |

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

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

People
Owner: HMBRAND [...] cpan.org
Requestors: bernd [...] sonardata.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.23
Fixed in: 0.28



Subject: Whitespace surrounding the sep_char is not supported (causes parse failure)
This took me some while to diagnose and suprised me significantly. But this line fails to parse: 1, "String" and this line parses successfully: 1,"String" the only difference is the space following the comma. Now this space is near ubiquitous in my experience. It's easy enough to fix by preprocessing the file (i.e. a workaround) but a fairly critical overisght in the CSV parser to my mind. There should at least be an option to ignore all white space (spaces and tabs) surrounding the sep_char. Anyhow, as I said, surpised me rather. I'll work around it without much trouble now, but it cost me an hour or so to find out what was causing this (as I'm working with huge CSV files with thousands upon thousands of columns and only one of them was causing this, so a painstaking trial and erro through the parse nailed it down to this, and now I'm rolling again.
In 0.28, you now have my $csv = Text::CSV_XS->new ({ allow_whitespace => 1 }); This allows what you want.