Reviewed & tested by the community
Project:
CSV Parser
Version:
6.x-1.0-alpha2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Apr 2009 at 05:18 UTC
Updated:
25 Apr 2009 at 10:33 UTC
Are you sure this is right? It doesn't smell right to me.
public function setDelimiter($delimiter) {
$this->delimiter = ',';
}
A setter should set the value it's given to the field it's supposed to set. That's not what this does.
Also, if you create a feed and specify a delimiter other than comma in the form, it doesn't behave as if it was told the delimiter you set. Instead it behaves as if ',' is the delimiter.
Comments
Comment #1
reikiman commentedOh, uh, that function is in parser_csv_parser.inc (in case it's not obvious)
Comment #2
reikiman commentedI changed that function to the expected, and it behaved properly based on the delimiter setting.
What I'm meaning is I have a file whose delimiter is '|'. Specifying that file it came up with a confused idea of the fields. Modifying parser_csv_parser.inc to hardcode the delimiter to '|' from the hardcoded ',' as it is now, and it came up with the correct idea of the fields, and properly created nodes with the correct fields. Making the above change also results with correctly created nodes with the correct fields.
Comment #3
jpetso commentedYah, sorry, that was my fault. I thought it was a porting error when transforming the original parser_csv_parser.inc into the version on Launchpad (http://launchpad.net/php-csv) - I already fixed it there, but hadn't suspected that it's in this module's version of the parser as well.
The suggested fix is the right one, please commit reikiman's changes from comment #2 or update to the Launchpad version altogether. Thanks!