csv-parser icon indicating copy to clipboard operation
csv-parser copied to clipboard

How is this a CSV Parser?

Open rakeshgk opened this issue 11 years ago • 5 comments

You are just using a tokenized approach to split the line at commas and return the fields back and not follow the standards of CSV specified in the RFC - http://tools.ietf.org/html/rfc4180

I tested it for one of the valid cases that programs adhering to the RFC standard should support Input 1997,Ford,E350,"Super, luxurious truck"

When I ask for the 4th field to be returned Your program returns - "Super The actual returned value should be - Super, luxurious truck

rakeshgk avatar Jan 01 '14 08:01 rakeshgk

Yes, the parser fails for these type of inputs. Also, the parser should be able to recognize escape characters and parse them accordingly. This parser also doesn't do that.

Patches are welcome!

psibi avatar Jan 01 '14 11:01 psibi

Thanks for the confirmation @psibi !!

rakeshgk avatar Jan 01 '14 12:01 rakeshgk

Looks like this code returns the wrong value for the last column values.

Need to reverse the string.

ssajjan avatar Sep 23 '16 02:09 ssajjan

It doesn't support UNICODE, like Chinese.

LickBag avatar Mar 09 '18 08:03 LickBag

when there is only one column in the csv file, the csv_parser will crash.

LickBag avatar Mar 09 '18 08:03 LickBag