File: ExcelCsvDataSet.php Lines 47 to 66 |
| 47 | { |
| 48 | if (!\is_file($csvFile)) { |
| 49 | throw new InvalidArgumentException("Could not find csv file: {$csvFile}"); |
| 50 | } |
| 51 | |
| 52 | if (!\is_readable($csvFile)) { |
| 53 | throw new InvalidArgumentException("Could not read csv file: {$csvFile}"); |
| 54 | } |
| 55 | |
| | $fh = \fopen($csvFile, 'rb'); |
| 57 | fseek($fh, 2); // after BOM |
| 58 | |
| 59 | // TODO streaming |
| 60 | $tmpFp = fopen('php://temp', 'w+b'); |
| 61 | fwrite($tmpFp, mb_convert_encoding(stream_get_contents($fh), 'UTF-8', 'UTF-16LE')); |
| 62 | rewind($tmpFp); |
| 63 | |
| 64 | $columns = $this->getCsvRow($tmpFp); |
| 65 | |
| 66 | if ($columns === false) { |
|