Data-Liberation-Front / csvlint.rb

The gem behind http://csvlint.io
MIT License
287 stars 88 forks source link

BUG: Improperly implements skipInitialSpace #107

Open jpmckinney opened 9 years ago

jpmckinney commented 9 years ago

specifies how to interpret whitespace which immediately follows a delimiter; if False, it means that whitespace immediately after a delimiter should be treated as part of the following field.

By this definition, the following CSV:

foo,bar, baz,   bzz

should parse as follows if skipInitialSpace is true:

["foo", "bar", "baz", "bzz"]

What csvlint's code does is set the delimiter to (the original delimiter, in this case ,, followed by a space). That parses the CSV as:

["foo,bar", "baz", "  bzz"]

Which is clearly incorrect.