[Csv] Something's fishy w/ Mac line endings...
Skip Montanaro
skip at pobox.com
Mon Aug 18 05:03:03 CEST 2003
>> There seems to be a problem with what it expects to see after the \r
>> character. It wants to see either a NUL or a \n followed by a NUL.
>> In this case, it sees the '0' which starts the next line.
Andrew> I wonder if it's a unicode issue?
Shouldn't be. The test case the submitter posted only uses ASCII.
Looking at the problem a bit, I see this call chain:
Reader_iternext ->
PyIter_Next ->
file_iternext ->
readahead_get_line_skip
readahead_get_line_skip notes the presence of \n and NUL terminates the line
it returns, but not the presense of \r.
I see one of two possible solutions:
1. See if readahead_get_line_skip should special-case \r when not
followed by \n. I think this may be the "most correct" approach.
2. Change Reader_iternext to not rely on a NUL following the putative
end-of-line character.
Skip
More information about the Csv
mailing list