Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV: parse header with line breaks (fixes #9172) #9182

Merged
merged 1 commit into from
Feb 18, 2024

Conversation

rouault
Copy link
Member

@rouault rouault commented Feb 1, 2024

No description provided.

@rouault rouault added this to the 3.9.0 milestone Feb 1, 2024
@jratike80
Copy link
Collaborator

I am curious. Does the code search for the longest line in the CSV for finding out how many columns there are, and then find as many column names from the beginning of the file?

@rouault
Copy link
Member Author

rouault commented Feb 1, 2024

Does the code search for the longest line in the CSV for finding out how many columns there are, and then find as many column names from the beginning of the file?

The implementation is at

CSVReadParseLineGeneric(void *fp, const char *(*pfnReadLine)(void *, size_t),
. Basically it will read extra lines if it detects that there is an odd number of double-quotes in a line
This function is what is used already to read non-header lines where such situation can happen. There is no reason not to use if for header lines too (the CSV format itself doesn't really distinguish header from non-header, which is just a convention often used, but not always)

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 68.797% (-0.002%) from 68.799%
when pulling b0b9a42 on rouault:fix_9172
into 85c93fd on OSGeo:master.

@rouault rouault merged commit 92423cb into OSGeo:master Feb 18, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants