Skip Menu |
Report information
Id: 127358
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: hmbrand <h.m.brand [at]>

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)

Subject: Default EOL behavior might cause data loss
$ dump crnl.csv [DUMP 0.6.01] 00000000 31 2C 32 2C 2C 22 34 22 2C 22 35 20 77 69 74 68 1,2,,"4","5 with 00000010 20 5C 72 5C 6E 0D 0A 20 65 6D 62 65 64 64 65 64 \r\n.. embedded 00000020 22 2C 36 0D 0A ",6.. $ cat use v6; my $fh = open "crnl.csv", :r, :!chomp; .perl.say for $fh.lines; $ perl6 "1,2,,\"4\",\"5 with \\r\\n\n" " embedded\",6\n" That first line should have been: "1,2,,\"4\",\"5 with \\r\\n\r\n" as the \r is part of the data, not of an EOL I need an option to leave every new-line sequence unchanged. The nl attribute for open won't work, as I cannot know in advance what the EOL sequence in the stream/file is and besides, CSV allows mixed EOL, so «1,2,,4\r\n1,2,3,\r1,,3,4\n» is completely valid CSV for Text::CSV As callers to the parsing process are allowed to open an already opened file (an IO stream), this new :preserve-nl attribute (or whatever it will be implemented as), should be alterable *after* the stream has been opened, so it can be changed to local behavior inside the parsing proces.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at