FourierTransformer / ftcsv

a fast csv library written in pure Lua
MIT License
73 stars 20 forks source link

Backslash-quoted quotation marks #13

Closed johnd0e closed 6 years ago

johnd0e commented 6 years ago

I have to work with data which contains quotation marks in fields, e.g.

"sample","\"quoted\"","\" mark"

Is it possible to support such quotation in ftcsv module? On upper example it behaves strange: second field appears empty.

And next example even get it crashed:

"\"text\"",\"2,"3

ftcsv.lua:255: attempt to perform arithmetic on local 'i' (a nil value) stack traceback: C:\Apps\Far3\Profile\Macros\modules\ftcsv.lua:255: in function 'parseString' C:\Apps\Far3\Profile\Macros\modules\ftcsv.lua:398: in function 'parse' ...

FourierTransformer commented 6 years ago

hmmmm... you could try to replace the backslash with a quote. ftcsv tries to do escaping of quotes with two quotes. I haven't ever tested it out with a quote right at the beginning of the field. I might look into that and see what happens.

johnd0e commented 6 years ago

You are right, csv in my case is not correct, so I'll better implement own functions to deal with it.

Still, even in terms of pure csv format, your code behaves wrong with upper data samples and need to be fixed.

FourierTransformer commented 6 years ago

I've fixed the related issues and the changes will be available in the next release!