-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
Milestone
Description
When exporting results as CSV, LibreOffice automatically detects UTF-8 encoding. This is not the case of Microsoft Excel, which requires BOM to select the correct encoding :
- https://en.wikipedia.org/wiki/Byte_order_mark
- https://support.microsoft.com/fr-fr/office/ouverture-correcte-des-fichiers-csv-utf-8-dans-excel-8a935af5-3416-4edd-ba7e-3dfd2bc4a032
It seems easier to adapt in White Pages than patching Microsoft Excel:
diff --git a/lib/csv.inc.php b/lib/csv.inc.php
index 9cd2cb7..69aa9d9 100644
--- a/lib/csv.inc.php
+++ b/lib/csv.inc.php
@@ -27,6 +27,9 @@ function download_send_headers($filename) {
// disposition / encoding on response body
header("Content-Disposition: attachment;filename={$filename}");
header("Content-Transfer-Encoding: binary");
+
+ // UTF-8 BOM
+ echo "\xEF\xBB\xBF";
}
?>
But as adding a BOM is not recommended, this should be an option, disabled by default.