View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0022182||Lazarus||LCL||public||2012-06-03 02:51||2012-06-09 19:28|
|Reporter||Nukool C.||Assigned To||Bart Broersma|
|Priority||normal||Severity||major||Reproducibility||have not tried|
|Product Version||0.9.31 (SVN)|
|Fixed in Version||1.1 (SVN)|
|Summary||0022182: TStringGrid.LoadFromCSVFile: incorrect handling of unquoted spaces and quoted fields with delimiters|
|Description||In MS Excel, I always select|
delimiter = Comma
text qualifier = "
for example in csv file there are many commas like 58,073,560.23
csv file ....
I t e m , D a t e , Q u o t a t i o n N o , A m o u n t
0 1 , 0 5 / 0 5 / 2 0 1 2 , Q T T 2 3 9 , " 3 , 6 2 4 , 9 9 7 . 3 1 "
I t e m D a t e Q u o t a t i o n N o A m o u n t
0 1 0 5 / 0 5 / 2 0 1 2 Q T T 2 3 9 3 , 6 2 4 , 9 9 7 . 3 1
It shows 1 character in 1 cell.
What should I do to solve this probem ?
Thank you in advance ...
|Tags||No tags attached.|
|Fixed in Revision||r37499, r37598|
There seems to be something wrong with your sample cvs data, there are spaces between each character, there may be several explanations but....
It would be much better if you attach the sample csv file to this report
See also :
||Please test and close if OK.|
I could test, but there is not cvs test file, please on next time when there is a problem when reading some file, please don't forget to ask for the file, I think there is nothing wrong in pasting some sample csv data, but as I said, they don't look normal and a paste will never sustitute a physical file, because of the BOM's, Encodings, etc.
Anyway, I followed the link to the mentioned topic and I probably wasn't careful enough, but I can't find a test csv file, just a repetition of what this bug report contains.
BTW, the original csv support in grids worked fine with anything I throw it, and if it doesn't effectively worked fine, then the probability that is a FPC problem is higher. While it's not bad to have temporal fix in LCL, a patch to fix the problem must be supplied to FPC and eventually the temporal fix removed from LCL.
But all this must be clear in order to better know how to proceed.
@Jesus: First there was an error when reading Tab-separated files: spaces were treated as delimiter.
So I changed behaviour to use StrictDelimiter := True.
This however introduced the behaviour described by Nukool C.
Quoted fields which contain delimiter are split on the delimiter.
This is wrong.
SL.Delimiter := ',';
SL.StrictDelimiter := True;
SL.DelimitedText := '01,05/05/2012,QTT239,"3,624,997.31"';
I cannot test if this is Delphi compatible or not, since my old Delphi (3) doesn't have DelimitedText.
The new implementation is a bit more forgiving when reading the data.
It now allows for spaces in unquoted fields (which effectively mostly is the case in Tab separated files), and it reverts the wrong handling of quoted fields with delimters inside.
||Not quit fixed yet with regard to leading and trailing spaces in unquoted fields. (See discussion on forum and related issue 0019610).|
|2012-06-03 02:51||Nukool C.||New Issue|
|2012-06-03 02:51||Nukool C.||Widgetset||=> Win32/Win64|
|2012-06-03 10:36||Jesus Reyes||Status||new => assigned|
|2012-06-03 10:36||Jesus Reyes||Assigned To||=> Jesus Reyes|
|2012-06-03 10:41||Jesus Reyes||LazTarget||=> -|
|2012-06-03 10:41||Jesus Reyes||Note Added: 0060212|
|2012-06-03 10:41||Jesus Reyes||Status||assigned => feedback|
|2012-06-03 12:53||Juha Manninen||Note Added: 0060216|
|2012-06-03 14:32||Bart Broersma||Fixed in Revision||=> r37499|
|2012-06-03 14:32||Bart Broersma||Status||feedback => resolved|
|2012-06-03 14:32||Bart Broersma||Fixed in Version||=> 1.1 (SVN)|
|2012-06-03 14:32||Bart Broersma||Resolution||open => fixed|
|2012-06-03 14:32||Bart Broersma||Note Added: 0060220|
|2012-06-03 14:33||Bart Broersma||Status||resolved => assigned|
|2012-06-03 14:33||Bart Broersma||Assigned To||Jesus Reyes => Bart Broersma|
|2012-06-03 14:34||Bart Broersma||Status||assigned => resolved|
|2012-06-03 20:49||Jesus Reyes||Note Added: 0060237|
|2012-06-04 09:57||Bart Broersma||Note Added: 0060246|
|2012-06-07 21:20||Marco van de Voort||Relationship added||related to 0019610|
|2012-06-08 14:00||Bart Broersma||Status||resolved => assigned|
|2012-06-08 14:00||Bart Broersma||Resolution||fixed => reopened|
|2012-06-08 14:00||Bart Broersma||Note Added: 0060377|
|2012-06-08 14:04||Bart Broersma||Summary||StringGrid1.LoadFromCSVFile(OpenDialog1.FileName,',',true) does not work. => TStringGrid.LoadFromCSVFile: incorrect handling of unquoted spaces and quoted fields with delimiters|
|2012-06-09 19:27||Bart Broersma||Fixed in Revision||r37499 => r37499, r37598|
|2012-06-09 19:27||Bart Broersma||Status||assigned => resolved|
|2012-06-09 19:27||Bart Broersma||Resolution||reopened => fixed|