From d05577d3037eaf8fa1c7fed121bcb68c166ff316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Bl=C3=A4ul?= Date: Fri, 2 Feb 2018 13:49:57 +0100 Subject: [PATCH] output(): Use better mime type for \t separator. Fixes #79 --- src/Csv.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Csv.php b/src/Csv.php index a4062f6..13f165f 100644 --- a/src/Csv.php +++ b/src/Csv.php @@ -455,7 +455,10 @@ class Csv { $flat_string = $this->unparse($data, $fields, null, null, $delimiter); if (!is_null($filename)) { - header('Content-type: application/csv'); + $mime = $delimiter === "\t" ? + 'text/tab-separated-values' : + 'application/csv'; + header('Content-type: ' . $mime); header('Content-Length: ' . strlen($flat_string)); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache');