On 28 Aug 2013, at 2:32pm, Simon Davies <simon.james.dav...@gmail.com> wrote:

> On 28 August 2013 14:16,  <to...@acm.org> wrote:
>> OK, now copy the data line several times, and you'll see there are errors
>> for several lines, unrelated to the final CRLF (which I removed this next
>> sample). [snip]
> 
> Agreed.
> The CR character seems not to be handled properly. Change CRLF to just
> LF, and the import succeeds. Change CRLF to CR and same failure as
> above.

Nice diagnosis.  Well done.

Technically, all CSV lines except the last should be delimited by CRLF, and the 
last line does not need (but may have) the CRLF.  RFC4180 2.1 and 2.2:

1.  Each record is located on a separate line, delimited by a line break (CRLF).
2.  The last record in the file may or may not have an ending line break.

In practise, most CSV importing software does something like

1. Convert all LF to CR.
2. Convert all CRCR to CR
3. Read data as lines delimited by CR
4. Ignore all lines which are entirely blank

so it doesn't matter.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to