mholt / PapaParse

Fast and powerful CSV (delimited text) parser that gracefully handles large files and malformed input
http://PapaParse.com
MIT License
12.47k stars 1.14k forks source link

When detecting \r\n line endings and using { header: true }, the last header name contains \r at the end #974

Open lerouxb opened 1 year ago

lerouxb commented 1 year ago

If you don't specify line endings to use, ie. leave it to be auto-detected, then the \r\n seems to only be detected once it reaches the end of the first line (which admittedly makes sense), but by then transformHeader() already got called with the header fields and the last one will contain the \r that preceded that first \n, allowing it to detect \r\n.

Similarly result.meta.fields' last element also has the \r at the end.

I'm working around this in my code, but thought I'd mention it here anyway as it is likely not what's intended.