diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/plugin_scripts_js/JavaScriptBridgeJS.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/plugin_scripts_js/JavaScriptBridgeJS.java index 565a6120..f36fc042 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/plugin_scripts_js/JavaScriptBridgeJS.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/plugin_scripts_js/JavaScriptBridgeJS.java @@ -147,7 +147,9 @@ public class JavaScriptBridgeJS { " });" + " }," + " arrayBufferToString: function(arrayBuffer) {" + - " return String.fromCharCode.apply(String, arrayBuffer);" + + " const uint8Array = new Uint8Array(arrayBuffer);" + + " const data = uint8Array.reduce((acc, i) => acc += String.fromCharCode.apply(null, [i]), '');" + + " return data;" + " }," + " isBodyFormData: function(bodyString) {" + " return bodyString.indexOf('------WebKitFormBoundary') >= 0;" + diff --git a/ios/Classes/PluginScriptsJS/JavaScriptBridgeJS.swift b/ios/Classes/PluginScriptsJS/JavaScriptBridgeJS.swift index 9aa6334d..8f9aa385 100644 --- a/ios/Classes/PluginScriptsJS/JavaScriptBridgeJS.swift +++ b/ios/Classes/PluginScriptsJS/JavaScriptBridgeJS.swift @@ -175,7 +175,9 @@ let UTIL_JS_SOURCE = """ }); }, arrayBufferToString: function(arrayBuffer) { - return String.fromCharCode.apply(String, arrayBuffer); + const uint8Array = new Uint8Array(arrayBuffer); + const data = uint8Array.reduce((acc, i) => acc += String.fromCharCode.apply(null, [i]), ''); + return data; }, isBodyFormData: function(bodyString) { return bodyString.indexOf('------WebKitFormBoundary') >= 0;