Skip to content
Snippets Groups Projects
Commit c0e3c98d authored by Jared Hancock's avatar Jared Hancock
Browse files

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.
parent e8cedfd6
Branches
Tags
No related merge requests found
...@@ -276,6 +276,7 @@ class CsvResultsExporter extends ResultSetExporter { ...@@ -276,6 +276,7 @@ class CsvResultsExporter extends ResultSetExporter {
if (!$this->output) if (!$this->output)
$this->output = fopen('php://output', 'w'); $this->output = fopen('php://output', 'w');
fputs($this->output, chr(0xEF) . chr(0xBB) . chr(0xBF));
fputcsv($this->output, $this->getHeaders()); fputcsv($this->output, $this->getHeaders());
while ($row=$this->next()) while ($row=$this->next())
fputcsv($this->output, $row); fputcsv($this->output, $row);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment