Ook goedemorgen BigChimp,
Multline fields are not yet supported in a StringGrid, so I did not implement this.
Well, they apparently are. Stringgrids retain the line ending in the cell's string. They just don't display it. See my example posted earlier - adjusted to also show cr is stored on windows:
(FPC 2.6.x, Laz trunk)
Multiline: a form, a stringgrid and a button; this:
procedure TForm1.Button1Click(Sender: TObject);
begin
StringGrid1.Cells[1,1]:='a'+LineEnding+'b';
ShowMessage('Found cr at position: '+inttostr(Pos(#13,StringGrid1.Cells[1,1])));
ShowMessage('Found lf at position: '+inttostr(Pos(#10,StringGrid1.Cells[1,1])));
end;
... which indicates line ending is stored in the stringgrid even though it is not currently displayed.
Furthermore, think a bit further. If multiline were not supported, don't you think people will try to read multiline csv files anyway and complain? Far better to support multiline import, than strip the line ending if necessary. However, that doesn't even seem necessary, see above.
If we woud consider doing that, then we cannot use TStringlist internally anymore, and have to design a completey different algorithm.
Doing what? Multiline support? Seems that already works.
Again IMO that calls for a single CSV handling routing (as in: 1 code in 1 place) and not have it all scattered around the place).
This code then should have as little depenencies as possible.
1. Have you read what I proposed? How is that "scattered around the place"?
1.1 Use csvdocument for all csv handling in Lazarus now
1.2 Try to get csvdocument in FPC and use that when it is stable (e.g. for dataset export to csv, future perhaps import from csv)
Surely better than the current situation (custom CSV code in the actual procedure)?
2. Have you looked at csvdocument and its dependencies?
Finally, if you don't want to use csvdocument... then you'd just be trying to rewrite it to deal with all exceptions/weird formats (RFC4180, Excel) etc. I don't see any reason to do that.
As previously discussed, FPC sdf format may be shoehorned into supporting csv format. If that is the case, I'd suggest that csvdocument be in FPC and we can rewrite that, to make it seamless to the user.