CSV export: add UTF-8 BOM header.

When exporting a poll to CSV, no BOM character is written. Most applications can
properly detect the required encoding, but some do not, and might find it
helpful to be able to read a BOM character.

--
Comment added 2019-04-16, nico@bou.io:

The issue is specifically with Excel that assumes Latin-1 by default, but switches to utf-8 if a BOM is present. On the other hand, LibreOffice and other apps seem to behave correctly with a BOM.
This commit is contained in:
Cyril Roelandt 2017-01-21 04:33:13 +01:00 committed by Nicolas Bouilleaud
parent b272a5a7a1
commit f626d29843

View File

@ -73,6 +73,7 @@ $slots = $pollService->allSlotsByPoll($poll);
$votes = $pollService->allVotesByPollId($poll_id);
// CSV header
echo "\xEF\xBB\xBF"; // BOM character for UTF-8
if ($poll->format === 'D') {
$titles_line = ',';
$moments_line = ',';