diff options
Diffstat (limited to 'it_pipe.class')
-rw-r--r-- | it_pipe.class | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/it_pipe.class b/it_pipe.class index b3c9d39..838fa39 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -92,12 +92,13 @@ function cols($collist) */ function csv() { - $schema = explode("\t", it::replace(array('"' => ''), trim(array_shift($this->lines), "#\n"))); + $splitchar = it::match("\t", $this->lines[0]) ? "\t" : ","; + $schema = str_getcsv(trim(array_shift($this->lines), "#\n"), $splitchar, '"'); # could do a function_exists('str_getcsv') here... $oldlocale = setlocale(LC_CTYPE, 'de_CH.iso-8859-1'); foreach ($this->lines as $line) - $records[] = (object)array_combine($schema, str_getcsv($line, "\t", '"')); # could do a function_exists('str_getcsv') here... + $records[] = (object)array_combine($schema, str_getcsv($line, $splitchar, '"')); # could do a function_exists('str_getcsv') here... setlocale(LC_CTYPE, $oldlocale); |