From c0e3c98dcce036e6256d44cb813de2b815e4239e Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Wed, 18 Mar 2015 18:59:45 -0500 Subject: [PATCH] csv: Add UTF-8 BOM to export file Because CSV has no way of indicating a content character set, writing the file with a Unicode byte-order mark is useful to declare the content in UTF-8 encoding. --- include/class.export.php | 1 + 1 file changed, 1 insertion(+) diff --git a/include/class.export.php b/include/class.export.php index 1743d3f72..5f2d729e2 100644 --- a/include/class.export.php +++ b/include/class.export.php @@ -276,6 +276,7 @@ class CsvResultsExporter extends ResultSetExporter { if (!$this->output) $this->output = fopen('php://output', 'w'); + fputs($this->output, chr(0xEF) . chr(0xBB) . chr(0xBF)); fputcsv($this->output, $this->getHeaders()); while ($row=$this->next()) fputcsv($this->output, $row); -- GitLab