diff options
author | Urban Müller | 2015-08-07 18:06:52 +0200 |
---|---|---|
committer | Urban Müller | 2015-08-07 18:06:52 +0200 |
commit | 7fd4e76f58d377cf978f97200145167eeb2aab9e (patch) | |
tree | 9f06e12daa56d18a05482de69858989d4cc68c95 /it_pipe.class | |
parent | 7357218e63e76862c2fb273f2d41ae1fcdf773bf (diff) | |
download | itools-7fd4e76f58d377cf978f97200145167eeb2aab9e.tar.gz itools-7fd4e76f58d377cf978f97200145167eeb2aab9e.tar.bz2 itools-7fd4e76f58d377cf978f97200145167eeb2aab9e.zip |
correctly determine and restore locale in csv()
Diffstat (limited to 'it_pipe.class')
-rw-r--r-- | it_pipe.class | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/it_pipe.class b/it_pipe.class index 737908a..6b43466 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -168,7 +168,8 @@ function csv($forceschema = null) foreach (preg_grep('/^$/', $cols) as $idx => $dummy) $cols[$idx] = "field$idx"; # replace empty column names - $oldlocale = setlocale(LC_CTYPE, 'de_CH.iso-8859-1'); # this works for utf-8 as well + $oldlocale = setlocale(LC_CTYPE, "0"); + setlocale(LC_CTYPE, 'de_CH.iso-8859-1'); # this works for utf-8 as well foreach ($this->lines as $line) $records[] = (object)array_combine($cols, str_getcsv($line, $splitchar, '"')); # could do a function_exists('str_getcsv') here... |