Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fails to parse data with custom delimiter #2

Closed
Shimuuar opened this Issue · 3 comments

2 participants

@Shimuuar

I tried to use custom delimiter but cassava fails to parse data. Here is test case

{-# LANGUAGE OverloadedStrings #-}
import Data.Csv

import qualified Data.ByteString.Lazy as BS
import Data.Vector (Vector)

txt :: BS.ByteString
txt = "first second third"

n = 32 -- or space

notOK :: Either String (Vector (String,String,String))
notOK = decodeWith (defaultDecodeOptions{decDelimiter = n}) txt

Result fo decoding is:

Left "conversion error: cannot unpack array of length 1 into a 3-tuple. Input record: fromList [\"first second third\"]"
@tibbe
Owner

As spaces are allowed unquoted in fields as per RFC 4180 they cannot be used as delimiters as it makes parsing ambiguous. I will update the docs to clarify that point.

@Shimuuar

Same thing for tabs.

@tibbe
Owner

That sounds wrong. I will investigate and write a test to make sure it work in the future. Custom parsing options is probably the least well-tested part of the code.

@tibbe tibbe closed this in 743d226
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.