summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_pipe.class2
1 files changed, 2 insertions, 0 deletions
diff --git a/it_pipe.class b/it_pipe.class
index 6847a5d..d002b5b 100644
--- a/it_pipe.class
+++ b/it_pipe.class
@@ -154,6 +154,8 @@ function csv()
$counts = count_chars($this->lines[0]);
$splitchar = $counts[ord("\t")] ? "\t" : ($counts[ord(";")] > $counts[ord(",")] ? ";" : ",");
$schema = str_getcsv(trim(array_shift($this->lines), "#\n "), $splitchar, '"'); # could do a function_exists('str_getcsv') here...
+ foreach (preg_grep('/^$/', $schema) as $idx => $dummy)
+ $schema[$idx] = "field$idx";
$oldlocale = setlocale(LC_CTYPE, 'de_CH.iso-8859-1');