csv fixes

This commit is contained in:
j 2018-12-05 17:31:25 +01:00
parent b42b14eed8
commit ed1e2a3360

View File

@ -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); var byteNumbers = new Array(data.length);
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
byteNumbers[i] = data.charCodeAt(i); byteNumbers[i] = data.charCodeAt(i);
} }
var byteArray = new Uint8Array(byteNumbers); 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; return blob;
} }
@ -522,7 +523,7 @@ $('button.export_sequence_csv').on({click: function() {
seq.seqid = uuidv4() 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); var url = window.URL.createObjectURL(blob);
$(this).parent().attr({ $(this).parent().attr({
href: url, download: 'sequence.csv' href: url, download: 'sequence.csv'