fix: #44 Fixed an issue where exporting presets with non latin 1 character was impossible.

This commit is contained in:
Quentin “Storm1er” Decaunes 2019-08-14 17:46:53 +02:00
parent ef35ffe128
commit 22554b41dc

View File

@ -7,7 +7,7 @@ function preset_export() {
var presets = settings.get('presets'); var presets = settings.get('presets');
presets = JSON.stringify(presets); presets = JSON.stringify(presets);
modalTextArea.innerHTML = btoa(presets); modalTextArea.innerHTML = btoa(unescape(encodeURIComponent(presets)));
} }
/** /**
@ -20,7 +20,7 @@ function preset_import() {
var presetsToBeImported; var presetsToBeImported;
try { try {
presetsToBeImported = atob(modalTextArea.value); presetsToBeImported = decodeURIComponent(escape(atob(modalTextArea.value)));
presetsToBeImported = JSON.parse(presetsToBeImported); presetsToBeImported = JSON.parse(presetsToBeImported);
} catch (e) { } catch (e) {
notification('danger', 'Unable to import presets, malformed data.'); notification('danger', 'Unable to import presets, malformed data.');