From: Stéphane Jacob Date: Mon, 24 Oct 2011 08:18:15 +0000 (+0200) Subject: Outputs iso-8859-1 in addresses list as excel cannot open utf-8 csv properly. X-Git-Tag: xorg/1.1.4~68 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=47712f77e9718652c516c85cde99a58d142f67c9;p=platal.git Outputs iso-8859-1 in addresses list as excel cannot open utf-8 csv properly. Signed-off-by: Stéphane Jacob --- diff --git a/include/userset.inc.php b/include/userset.inc.php index 8dc2794..bcbe20e 100644 --- a/include/userset.inc.php +++ b/include/userset.inc.php @@ -425,7 +425,7 @@ class AddressesView implements PlView { $pids = $this->set->getIds(new PlLimit()); $visibility = Visibility::defaultForRead(Visibility::VIEW_AX); - pl_cached_content_headers('text/x-csv', 'utf-8', 1, 'adresses.csv'); + pl_cached_content_headers('text/x-csv', 'iso-8859-1', 1, 'adresses.csv'); $csv = fopen('php://output', 'w'); fputcsv($csv, array('adresses'), ';'); @@ -436,7 +436,7 @@ class AddressesView implements PlView WHERE pa.type = \'home\' AND pa.pub IN (\'public\', \'ax\') AND FIND_IN_SET(\'mail\', pa.flags) AND pa.pid IN {?} GROUP BY pa.pid', $pids); foreach ($res->fetchAllAssoc() as $item) { - fputcsv($csv, $item, ';'); + fputcsv($csv, array_map('utf8_decode', $item), ';'); } } fclose($csv);