diff options
Diffstat (limited to 'it_pipe.class')
-rw-r--r-- | it_pipe.class | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/it_pipe.class b/it_pipe.class index 8c7f92f..77ef565 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -201,7 +201,7 @@ function csv($p = []) $p = is_string($p) ? ['forceschema' => $p] : $p; $counts = count_chars($this->lines[0]); $splitchar = $counts[ord("\t")] ? "\t" : ($counts[ord(";")] > $counts[ord(",")] ? ";" : ","); - $csvhead = array_shift($this->lines); + $csvhead = it::replace(['^\x{FEFF}' => ''], array_shift($this->lines)); // it::replace removes utf8 byte order mark $cols = $p['forceschema'] ? explode(",", $p['forceschema']) : str_getcsv(trim($csvhead, "#\n "), $splitchar, '"'); # should function_exists('str_getcsv') foreach ($cols as $idx => $col) $cols[$idx] = it::replace(['^$' => "field$idx", '\W' => $p['fixcolnames'] ? "_" : '$0'], $col); |