From ed1e2a336090fde3287be6d5864d825359d6f263 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 5 Dec 2018 17:31:25 +0100 Subject: [PATCH] csv fixes --- static/js/cccc.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/static/js/cccc.js b/static/js/cccc.js index e618aa6..54060ed 100644 --- a/static/js/cccc.js +++ b/static/js/cccc.js @@ -467,13 +467,14 @@ $('button.set_speed').on({click: function() { }}) -function textBlob(data) { +function textBlob(data, type) { + type = type || 'text/plain; charset=utf-8'; var byteNumbers = new Array(data.length); for (var i = 0; i < data.length; i++) { byteNumbers[i] = data.charCodeAt(i); } var byteArray = new Uint8Array(byteNumbers); - var blob = new Blob([byteArray], {type: 'text/plain; charset=utf-8'}); + var blob = new Blob([byteArray], {type: type}); return blob; } @@ -522,7 +523,7 @@ $('button.export_sequence_csv').on({click: function() { seq.seqid = uuidv4() } }) - var blob = textBlob(JSON.stringify(exportSequenceCSV(), null, ' ')) + var blob = textBlob(exportSequenceCSV(), 'text/csv; charset=utf-8') var url = window.URL.createObjectURL(blob); $(this).parent().attr({ href: url, download: 'sequence.csv'