From fbd8db08df0dddc9f9f9d3f88fc336f7fa736c68 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Thu, 30 May 2024 09:18:09 +0200 Subject: [PATCH] Remove encoding choice at export, choose encoding automatically --- .../src/main/webapp/js/tour-standings.inc.js | 13 +++++-------- view-webapp/src/main/webapp/tour-standings.inc.html | 7 ------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/view-webapp/src/main/webapp/js/tour-standings.inc.js b/view-webapp/src/main/webapp/js/tour-standings.inc.js index 9a64f2d..4eda99c 100644 --- a/view-webapp/src/main/webapp/js/tour-standings.inc.js +++ b/view-webapp/src/main/webapp/js/tour-standings.inc.js @@ -1,7 +1,6 @@ -function publish(format, extension) { +function publish(format, extension, encoding) { let form = $('#tournament-infos')[0]; let shortName = form.val('shortName'); - let encoding = $('#encoding')[0].value; let hdrs = headers(); hdrs['Accept'] = `${format};charset=${encoding}` fetch(`api/tour/${tour_id}/standings/${activeRound}`, { @@ -10,9 +9,7 @@ function publish(format, extension) { if (resp.ok) return resp.arrayBuffer() else throw "publish error" }).then(bytes => { - let blob = new Blob( - encoding === 'utf-8' ? ['\uFEFF', bytes] : [bytes], - { type: `text/plain;charset=${encoding}` }); + let blob = new Blob([bytes], { type: `text/plain;charset=${encoding}` }); downloadFile(blob, `${shortName}.${extension}`); close_modal(); }).catch(err => showError(err)); @@ -77,13 +74,13 @@ onLoad(() => { }); */ $('.publish-ffg').on('click', e => { - publish('application/ffg', 'tou'); + publish('application/ffg', 'tou', 'iso-8859-1'); }); $('.publish-egf').on('click', e => { - publish('application/egf', 'h' + (typeof(correction) === 'number' && correction > 0 ? correction : 9 )); + publish('application/egf', 'h' + (typeof(correction) === 'number' && correction > 0 ? correction : 9 ), 'iso-8859-1'); }); $('.publish-csv').on('click', e => { - publish('text/csv', 'csv'); + publish('text/csv', 'csv', 'utf-8'); }); $('.publish-html').on('click', e => { publishHtml(); diff --git a/view-webapp/src/main/webapp/tour-standings.inc.html b/view-webapp/src/main/webapp/tour-standings.inc.html index af3e65d..f16b836 100644 --- a/view-webapp/src/main/webapp/tour-standings.inc.html +++ b/view-webapp/src/main/webapp/tour-standings.inc.html @@ -104,13 +104,6 @@
Warning: publishing partial results at round $round out of $tour.rounds!
#end
-
- - -