From 6169e16c7521c50bdaf5aeb1cc0656bb2c5d2a99 Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Wed, 5 Sep 2018 18:29:07 +0200 Subject: [PATCH] B #2384: Start script base64 enconding fails when using non utf8 chars (#2385) --- .../templates-tab/form-panels/create/wizard-tabs/context.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js index 50d7881012..a4508176e9 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js @@ -232,7 +232,7 @@ define(function(require) { var start_script = WizardFields.retrieveInput($(".START_SCRIPT", context)); if (start_script != "") { if ($(".ENCODE_START_SCRIPT", context).is(":checked")) { - contextJSON["START_SCRIPT_BASE64"] = btoa($(".START_SCRIPT", context).val()); + contextJSON["START_SCRIPT_BASE64"] = btoa(unescape(encodeURIComponent($(".START_SCRIPT", context).val()))); } else { contextJSON["START_SCRIPT"] = start_script; } @@ -341,7 +341,7 @@ define(function(require) { } else if ("START_SCRIPT_BASE64" == key) { $(".ENCODE_START_SCRIPT", context).prop('checked', 'checked'); - $(".START_SCRIPT", context).val(atob(value)); + $(".START_SCRIPT", context).val(decodeURIComponent(escape(window.atob(value)))); } else if ("START_SCRIPT" == key) { WizardFields.fillInput($(".START_SCRIPT", context), value); } else {