-
Notifications
You must be signed in to change notification settings - Fork 176
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
auto()/autoDetectionForDataString() cannot determine delimiter with a single row file #206
Comments
Out of curiosity, what happens if you remove the linebreak ( The delimiter detection works by a process of elimination, finding all characters in each record (line) which are likely to be a delimiter character, and that appear the exact same number of times outside of quoted fields on each line. So I'm thinking possibly the delimiter detection is getting confused when there's only a single record with a linebreak after it, so it thinks there's actually two records, at which point TAB ( That said, it was around 15 years ago I wrote the original delimiter detection implementation, and I'm not that familiar with the codebase anymore... lol |
@jimeh The end of file character was not the issue. @atbigelow The function Thanks to both of you for your input on this issue! |
@fonata ah, that makes sense. No clue why I wouldn't have thought to cater for that back in the day with the original implementation 🤦♂️ |
tab_test.csv
Running
auto()
orautoDetectionForDataString()
on the contents of this file does not properly determine the delimiter.The example of
Should result in
$csv->delimiter
being a tab, but it is in fact false.My workaround at this point is to first check if the file has multiple rows, and if not, re-insert the same string into
$file_data
so it can work withautoDetectionForDataString
, and then callparse
on the original string. There doesn't seem to be a way to workaround a straightauto
call.The text was updated successfully, but these errors were encountered: