From 9cf1381cfa2bf227e964430812993e106ba81d1c Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Fri, 11 Dec 2015 10:25:24 +0000 Subject: [PATCH] SSDM-2899 : UTF-16LE Support on the ELN SVN: 35286 --- .../1/as/webapps/eln-lims/html/lib/grid/js/Grid.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.js index 47fc7869692..b6388a4df94 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.js @@ -177,7 +177,16 @@ $.extend(Grid.prototype, { var tsv = $.tsv.formatRows(arrayOfRowArrays); var indexOfFirstLine = tsv.indexOf('\n'); var tsvWithoutNumbers = tsv.substring(indexOfFirstLine + 1); - var blob = new Blob([tsvWithoutNumbers], {type: 'text'}); + + // + var csvContentEncoded = (new TextEncoder("utf-16le")).encode([tsvWithoutNumbers]); + var bom = new Uint8Array([0xFF, 0xFE]); + var out = new Uint8Array( bom.byteLength + csvContentEncoded.byteLength ); + out.set( bom , 0 ); + out.set( csvContentEncoded, bom.byteLength ); + // + + var blob = new Blob([out], {type: 'text/tsv;charset=UTF-16LE;'}); saveAs(blob,'exportedTable' + namePrefix + '.tsv'); } -- GitLab