Read CSV file with newlines in fields?
Posted on 2004-08-22
I'm trying to read a CSV file which is the result of saving a folder of Outlook emails. (Excel reads it fine - one row per email.) Field 2 is the body of the message, and it contains CR/LF chars. To get around this non-standard CSV format, I'm using the Text::CSV_XS module, with the "binary => 1" switch. That seems to work when I call it with a 1 record 'here document', but if I open a file and read it with a 'while' loop, then of course, it only reads 1 record (delimitten by CR) at a time. So, the record ends part way through field 2!
How can I read this CSV file so that one email is read at a time (I guess) and field 2 contains the entire body of the message?