cnuernber / charred

zero dependency efficient read/write of json and csv data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash if csv is ending with carriage-return

maxthoursie opened this issue · comments

user=> (charred.api/read-csv "header\r1\r")
Error printing return value at charred.CharReader/unread (CharReader.java:122).
Unread too far - current buffer empty

Since carriage-return seems to be a supported line separator, this is clearly an error.

There seems to be a related problem in clojure.data.csv. It doesn't crash, but it doesn't trim the last newline as it does for \n

user=> (clojure.data.csv/read-csv "header\r1\r")
(["header"] ["1"] ["�"])

This is with charred 1.007

Agreed - Definitely an error

Fixed 1.008 - thanks great detailed catch.

Thanks for a super quick fix!