When using league/csv to read a csv file, how could I know which csv controls have been used to parse the file ?
I made different csv files :
When using
use League\Csv\Reader;
...
//Read csv from path
$csvReader = Reader::createFromPath( $CSVFile->path );
//get the current delimiter ? Nope always the default one ...
$this->delimiter = $csvReader->getDelimiter();
EDIT: What I want to know is which delimiter has been used by the current reader. Not the delimiter in the csv file itself.
Whatever the file I use to read the csv, it always gives "," {coma} So I'm asking here:
How to know which delimiter/enclosure were used to parse the current csv Reader ?
I've also tried using getIterator(). Get default values too.
If you are using the latest version of the library you can simply use Reader::fetchDelimitersOccurrence as explained in the documentation. But be aware that the method will only return information about the suggested delimiters you supply. Because it is not possible for the method to know which delimiter is in use. The result is only a hint that needs to be confirm by the CSV provider.