From 22554b41dc0d863bbea53da51b2e97a7cbc318d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20=E2=80=9CStorm1er=E2=80=9D=20Decaunes?= Date: Wed, 14 Aug 2019 17:46:53 +0200 Subject: [PATCH] fix: #44 Fixed an issue where exporting presets with non latin 1 character was impossible. --- js/preset.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/preset.js b/js/preset.js index f8d1cb4..7af6af2 100644 --- a/js/preset.js +++ b/js/preset.js @@ -7,7 +7,7 @@ function preset_export() { var presets = settings.get('presets'); presets = JSON.stringify(presets); - modalTextArea.innerHTML = btoa(presets); + modalTextArea.innerHTML = btoa(unescape(encodeURIComponent(presets))); } /** @@ -18,9 +18,9 @@ function preset_import() { const settings = require('electron-settings'); var currentPresets = settings.get('presets'); var presetsToBeImported; - + try { - presetsToBeImported = atob(modalTextArea.value); + presetsToBeImported = decodeURIComponent(escape(atob(modalTextArea.value))); presetsToBeImported = JSON.parse(presetsToBeImported); } catch (e) { notification('danger', 'Unable to import presets, malformed data.');