Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-10

StringGrid1.LoadFromCSVFile problem

13 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

fecske fecske

I like to use the StringGrid1.LoadFromCSVFile() function. It works but also randomly ?set to a last line of strange characters

?
In the CSV file normail view are not these characters. I checked csv files in hex viewer and are not these characters.

I did a test, I wrote a Delphi code in a delphi IDE with unique function and stringgrid, and are not these characters.too. I use the same csv files.

What's wrong in the LoadFromCSVFile() function?

Please help me?

?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151022/9e21d817/attachment-0001.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: 2015-10-22 15_09_00-Form1.png
Type: image/png
Size: 13107 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151022/9e21d817/attachment-0002.png> -------------- next part --------------
A non-text attachment was scrubbed...
Name: 2015-10-22 15_11_33-Form1.png
Type: image/png
Size: 7648 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151022/9e21d817/attachment-0003.png>

Reply by email

Jesus Reyes A.
to fecske fecske
fecske fecske wrote
I like to use the StringGrid1.LoadFromCSVFile() function. It works but also randomly ?set to a last line of strange characters

..

Show quoted text 10 lines
In the CSV file normail view are not these characters. I checked csv files in hex viewer and are not these >characters. I did a test, I wrote a Delphi code in a delphi IDE with unique function and stringgrid, and are not these >characters.too. I use the same csv files. What's wrong in the LoadFromCSVFile() function? Please help me?

What Lazarus version/revision do you use?. Please attach a sample csv file.

Jesus Reyes A.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151022/a006413b/attachment.html>

Reply by email

fecske fecske
to Jesus Reyes A.

Lazarus SVN Rev 49771 (embed in CpdeTyphon 5.5 r49844 with FPC 3.1.1)

and csv in the attache

Jesus Reyes A. wrote 31 lines
On Thu, 22 Oct 2015 12:13:17 -0500, fecske fecske wrote: I like to use the StringGrid1.LoadFromCSVFile() function. It works but also randomly ?set to a last line of strange characters .. In the CSV file normail view are not these characters. I checked csv files in hex viewer and are not these characters. I did a test, I wrote a Delphi code in a delphi IDE with unique function and stringgrid, and are not these characters.too. I use the same csv files. What's wrong in the LoadFromCSVFile() function? Please help me? What Lazarus version/revision do you use?. Please attach a sample csv file. Jesus Reyes A. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151022/1e6dd7db/attachment.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: 2015_10_15.log
Type: application/octet-stream
Size: 1418 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151022/1e6dd7db/attachment.obj>

Reply by email

Mattias Gaertner
to fecske fecske: I like to use the StringGrid1.LoadFromCSVFile() function. It works but also randomly ?set…
Show quoted text 13 lines
I like to use the StringGrid1.LoadFromCSVFile() function. It works but also randomly ?set to a last line of strange characters ? In the CSV file normail view are not these characters. I checked csv files in hex viewer and are not these characters. I did a test, I wrote a Delphi code in a delphi IDE with unique function and stringgrid, and are not these characters.too. I use the same csv files. What's wrong in the LoadFromCSVFile() function?

In LoadFromCSVStream.StorePart the Inc(leadPtr) needs to check if at end of stream. I added that in revision 50144.

Mattias

Reply by email

fecske fecske
to Mattias Gaertner

I patch the lcsvutils.pas file based on LoadFromCSVStream: quote from here: https://github.com/graemeg/lazarus/commit/90eaed173991cdb8f8209726a71081299833392d

I compiled it in the ide but the problem still remains...

this video presents the phenomenon
https://youtu.be/GLXUkcrA-AA

Mattias Gaertner wrote 27 lines
On Thu, 22 Oct 2015 19:13:17 +0200 fecske fecske wrote: > I like to use the StringGrid1.LoadFromCSVFile() function. > It works but also randomly set to a last line of strange characters > > > In the CSV file normail view are not these characters. I checked csv files > in hex viewer and are not these characters. > > > I did a test, I wrote a Delphi code in a delphi IDE with unique function > and stringgrid, and are not these characters.too. > I use the same csv files. > > What's wrong in the LoadFromCSVFile() function? In LoadFromCSVStream.StorePart the Inc(leadPtr) needs to check if at end of stream. I added that in revision 50144. Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

fecske fecske
to Mattias Gaertner
Mattias Gaertner wrote
The UTF16 conversion was wrong. It was missing the ending #0 wide char. I fixed that in revision 50146. Mattias

I could now test the Lazarus SVN Rev 50211
Unfortunately, I experience the same problem.
https://youtu.be/0OdBpKAwXGM

I use it 'tab' delimiter #9.

Here's the code:
procedure TForm1.FileListBox1Click(Sender: TObject);
  begin
    StringGrid1.LoadFromCSVFile(FileListBox1.FileName, #9, TRUE, 3 ,TRUE);
  end;

I did a test, I wrote a Delphi code in a delphi IDE with unique function and stringgrid, and are not these characters and some lines not displayed correctly
I use the same csv files.
can be found in the attached zip file

Zsolt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.zip
Type: application/zip
Size: 6620 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151106/133d808c/attachment-0001.zip>

Reply by email

fecske fecske
to fecske fecske
fecske fecske wrote 5 lines
On Thu, Oct 22, 2015 at 11:37 PM, Mattias Gaertner wrote: > The UTF16 conversion was wrong. It was missing the ending #0 wide char. > I fixed that in revision 50146. > Mattias

Sorry this is so correct:
I did a test, I wrote a Delphi code in a delphi IDE with unique function and stringgrid, and are not these characters and as lines displayed correctly

Zsolt.

Reply by email

Mattias Gaertner
to fecske fecske: On Thu, Oct 22, 2015 at 11:37 PM, Mattias Gaertner I could now test the Lazarus SVN Rev…
Show quoted text 18 lines
[...] I could now test the Lazarus SVN Rev 50211 Unfortunately, I experience the same problem. https://youtu.be/0OdBpKAwXGM I use it 'tab' delimiter #9. Here's the code: procedure TForm1.FileListBox1Click(Sender: TObject); begin StringGrid1.LoadFromCSVFile(FileListBox1.FileName, #9, TRUE, 3 ,TRUE); end; I did a test, I wrote a Delphi code in a delphi IDE with unique function and stringgrid, and are not these characters and some lines not displayed correctly I use the same csv files. can be found in the attached zip file

Fixed.

Mattias

Reply by email

fecske fecske
to Mattias Gaertner

I was fixed this line in my lcsvutils.pas and the problem with lines It has been okay.
System.Move(leadPtr^,W[1],length(W)*2);

And the last line of strange characters It is still not ok... https://youtu.be/5US9mdUxSm4

Mattias Gaertner wrote 31 lines
On Fri, 6 Nov 2015 09:15:31 +0100 fecske fecske wrote: >[...] > I could now test the Lazarus SVN Rev 50211 > Unfortunately, I experience the same problem. > https://youtu.be/0OdBpKAwXGM > > I use it 'tab' delimiter #9. > > Here's the code: > procedure TForm1.FileListBox1Click(Sender: TObject); > begin > StringGrid1.LoadFromCSVFile(FileListBox1.FileName, #9, TRUE, 3 ,TRUE); > end; > > I did a test, I wrote a Delphi code in a delphi IDE with unique > function and stringgrid, and are not these characters and some lines > not displayed correctly > I use the same csv files. > can be found in the attached zip file Fixed. Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mattias Gaertner
to fecske fecske
Show quoted text 6 lines
I was fixed this line in my lcsvutils.pas and the problem with lines It has been okay. System.Move(leadPtr^,W[1],length(W)*2); And the last line of strange characters It is still not ok... https://youtu.be/5US9mdUxSm4

Are you using trunk?

It works here and your error looks exactly like the bug I fixed a month ago.

Mattias

Reply by email

fecske fecske
to Mattias Gaertner

I use CodeTyphon (ver 5.60 revision 005512) with Lazarus SVN Rev 50211 I changed it here in the lcsvutils.pas line 193
(System.Move(leadPtr^,W[1],length(W)*2);) and I compiled in the my project.

You fixed a month ago is in the Lazarus Revision 50146

Mattias Gaertner wrote 22 lines
On Fri, 6 Nov 2015 14:55:14 +0100 fecske fecske wrote: > I was fixed this line in my lcsvutils.pas and the problem with lines > It has been okay. > System.Move(leadPtr^,W[1],length(W)*2); > > And the last line of strange characters It is still not ok... > https://youtu.be/5US9mdUxSm4 Are you using trunk? It works here and your error looks exactly like the bug I fixed a month ago. Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mattias Gaertner
to fecske fecske
Show quoted text 6 lines
I use CodeTyphon (ver 5.60 revision 005512) with Lazarus SVN Rev 50211 I changed it here in the lcsvutils.pas line 193 (System.Move(leadPtr^,W[1],length(W)*2);) and I compiled in the my project. You fixed a month ago is in the Lazarus Revision 50146

If the bug is still present, please create a bug report.

Mattias

Reply by email