TCSVDataset ignoring Delimiter
Original Reporter info from Mantis: 7bit
-
Reporter name: Bernd Kreuss
Original Reporter info from Mantis: 7bit
- Reporter name: Bernd Kreuss
Description:
TCSVDataset will only work with comma delimiter, setting a different delimiter has no effect.
Steps to reproduce:
with the following test.csv:
foo;bar
42;23
This code:
CSV := TCSVDataset.Create(self);
CSV.CSVOptions.FirstLineAsFieldNames := True;
CSV.CSVOptions.Delimiter := ';';
CSV.CSVOptions.IgnoreOuterWhitespace := True;
CSV.LoadFromCSVFile('test.csv');
WriteLn(CSV.FieldCount);
WriteLn(CSV.FieldDefs[0].Name);
will produce this output:
1
foo;bar
When I change my csv file to use commas then it will output
2
foo
Additional information:
Somehow the Information from CSVOptions is not properly propagated down to all the numerous csv parser and handler objects that are created further down the line, for example there is a TCVSHandler class somewhere deep down within it that seems to be initialized with hardcoded default separators, but I could not really debug it yet because I have not even partially understood how all this works internally and also my computer here at work does not have FPC with debug symbols installed and I can't afford to break my productive installation currently.
Mantis conversion info:
- Mantis ID: 36278
- Version: 3.0.4
- Fixed in version: 3.3.1
- Target version: 3.2.0