From 380c26a1fe6bc3d4a7409e364002284bb1efcf89 Mon Sep 17 00:00:00 2001 From: IKAR0S Date: Tue, 14 Oct 2014 11:46:41 +0100 Subject: [PATCH 1/2] Exporting accentuated characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change fixes exporting accentuated characters like à á õ Ç (etc) that appear in series names in Windows Excel (tested). --- export-csv.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/export-csv.js b/export-csv.js index a98cdc4..8a6ff2a 100644 --- a/export-csv.js +++ b/export-csv.js @@ -75,7 +75,7 @@ if (downloadAttrSupported) { // Client side extraction a = document.createElement('a'); - a.href = 'data:attachment/csv,' + this.getCSV().replace(/\n/g, '%0A'); + a.href = 'data:attachment/csv;charset=utf-8,%EF%BB%BF,' + this.getCSV().replace(/\n/g, '%0A'); a.target = '_blank'; a.download = (this.title ? this.title.textStr.replace(/ /g, '-').toLowerCase() : 'chart') + '.csv'; document.body.appendChild(a); From aaaf7087fd4d7ec38ab1132998fc6ef625cb6142 Mon Sep 17 00:00:00 2001 From: IKAR0S Date: Tue, 14 Oct 2014 12:34:37 +0100 Subject: [PATCH 2/2] Fix to my submit Removed an extra comma next to %EF%BB%BF. Sorry for that. --- export-csv.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/export-csv.js b/export-csv.js index 8a6ff2a..bd34e15 100644 --- a/export-csv.js +++ b/export-csv.js @@ -75,7 +75,7 @@ if (downloadAttrSupported) { // Client side extraction a = document.createElement('a'); - a.href = 'data:attachment/csv;charset=utf-8,%EF%BB%BF,' + this.getCSV().replace(/\n/g, '%0A'); + a.href = 'data:attachment/csv;charset=utf-8,%EF%BB%BF' + this.getCSV().replace(/\n/g, '%0A'); a.target = '_blank'; a.download = (this.title ? this.title.textStr.replace(/ /g, '-').toLowerCase() : 'chart') + '.csv'; document.body.appendChild(a);