mishandling of embedded NULs (was: Re: [Csv] trial zip/tar packages of csv module available)

Dave Cole djc at object-craft.com.au
Sun Feb 16 23:52:51 CET 2003


>>>>> "John" == John Machin <sjmachin at lexicon.net> writes:

Dave> The '\0' to indicate line termination is a hang over from my
Dave> original code.  There is no reason why the code could not just
Dave> use '\n' to signal end of line (like every one else on the
Dave> planet).

John> Are you sure? I had the impression that it was used as an
John> out-of-band signal -- something that didn't appear in the data
John> (you hope!) -- so that you could take exception to newlines that
John> weren't at the end of line.

The outer loop of the parser was detecting end of line variations
'\n', '\r\n', and '\r' and checks for following characters.  If
characters are discovered an exception is raised.  If no characters
are following, the inner parsing code is passed '\0' to indicate end
of line.

Since there was no way for the inner code to ever receive a '\n' as
data, I changed the '\0' special value to '\n'.

- Dave

-- 
http://www.object-craft.com.au



More information about the Csv mailing list