浏览代码

Export csv file as utf8 see BT#10895

jmontoyaa 7 年之前
父节点
当前提交
2a4ea89fd6
共有 1 个文件被更改,包括 3 次插入5 次删除
  1. 3 5
      main/inc/lib/export.lib.inc.php

+ 3 - 5
main/inc/lib/export.lib.inc.php

@@ -42,10 +42,9 @@ class Export
         }
 
         $filePath = api_get_path(SYS_ARCHIVE_PATH).uniqid('').'.csv';
-
-        $writer = new CsvWriter();
-        $writer->setStream(fopen($filePath, 'w'));
-
+        $stream = fopen($filePath, 'w');
+        $writer = new CsvWriter(';', '"', $stream, true);
+        $writer->prepare();
         foreach ($data as $item) {
             if (empty($item)) {
                 $writer->writeItem([]);
@@ -75,7 +74,6 @@ class Export
         $file = new \SplFileObject($filePath, 'w');
         $writer = new ExcelWriter($file);
         $writer->prepare();
-
         foreach ($data as $row) {
             $writer->writeItem($row);
         }