[fpc-pascal] Issue with CSVDocument
James Richters
james.richters at productionautomation.net
Mon Feb 7 19:16:59 CET 2022
>I have fixed this in trunk.
I updated to the current trunk and indeed your fix has solved the issue... for excel files, however if I try it with a text file.. something that I type in from scratch with a text editor, it crashes with:
Running "i:\programming\gcode\1d cut\1d.exe x:\text.CSV"
Input From File: x:\text.CSV
An unhandled exception occurred at $0041F2C8:
EStreamError: Invalid stream operation TReadBufStream.Seek
$0041F2C8
$00430BBB
$0041F01C
$0042D6E2
$0042CDFF
$0042CD6B
It seems to be CSVData.LoadFromFile(ParamStr(1));
that causes the crash, because I have a writeln right under that and that never happens. I don't know why I'm not getting the backtrace, it is turned on.
But if I remove
CSVData.DetectBOM := True;
Then it's fine.... for text files.. still garbage in Excel files.
Apparently DetectBOM requires for it to be there? Seems like if it's detecting, it should detect it's absence and it should be fine.
Is there a way around this? Maybe there is a way I can check for this BOM thing and activate DetectBOM if it's there?
I would like my program to function for an exported CSV file from excel or from something input into a text editor either way and just work.
Thank you for your help
James
More information about the fpc-pascal
mailing list