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:
parent
b272a5a7a1
commit
f626d29843
|
@ -73,6 +73,7 @@ $slots = $pollService->allSlotsByPoll($poll);
|
||||||
$votes = $pollService->allVotesByPollId($poll_id);
|
$votes = $pollService->allVotesByPollId($poll_id);
|
||||||
|
|
||||||
// CSV header
|
// CSV header
|
||||||
|
echo "\xEF\xBB\xBF"; // BOM character for UTF-8
|
||||||
if ($poll->format === 'D') {
|
if ($poll->format === 'D') {
|
||||||
$titles_line = ',';
|
$titles_line = ',';
|
||||||
$moments_line = ',';
|
$moments_line = ',';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user