From 71d989ab47fb5c2d87f252aa2bc8b80de9665b03 Mon Sep 17 00:00:00 2001 From: Max Pozdeev Date: Sat, 29 Jun 2019 17:05:18 +0300 Subject: [PATCH] * use semicolons instead of commas as separator and add BOM in CSV export --- src/export.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/export.php b/src/export.php index d10a454..2628bd1 100644 --- a/src/export.php +++ b/src/export.php @@ -2,7 +2,7 @@ /* This file is part of myTinyTodo. - (C) Copyright 2010-2011 Max Pozdeev + (C) Copyright 2010-2011,2019 Max Pozdeev Licensed under the GNU GPL v2 license. See file COPYRIGHT for details. */ @@ -46,12 +46,16 @@ function have_write_access() function printCSV($listData, $data) { - $s = /*chr(0xEF).chr(0xBB).chr(0xBF).*/ "Completed,Priority,Task,Notes,Tags,Due,DateCreated,DateCompleted\n"; + $s = "\xEF\xBB\xBF". "Completed;Priority;Task;Notes;Tags;Due;DateCreated;DateCompleted\n"; foreach($data as $r) { - $s .= ($r['compl']?'1':'0'). ','. $r['prio']. ','. escape_csv($r['title']). ','. - escape_csv($r['note']). ','. escape_csv($r['tags']). ','. $r['duedate']. - ','. date('Y-m-d H:i:s O',$r['d_created']). ','. ($r['d_completed'] ? date('Y-m-d H:i:s O',$r['d_completed']) :''). "\n"; + $s .= ($r['compl']?'1':'0'). ';'. + $r['prio']. ';'. escape_csv($r['title']). ';'. + escape_csv($r['note']). ';'. + escape_csv($r['tags']). ';'. + $r['duedate']. ';'. + date('Y-m-d H:i:s O',$r['d_created']). ';'. + ($r['d_completed'] ? date('Y-m-d H:i:s O',$r['d_completed']) :''). "\n"; } header('Content-type: text/csv; charset=utf-8'); header('Content-disposition: attachment; filename=list_'.$listData['id'].'.csv');