我用python代码调用js,这个是js:function resultdecode(data) { console.log("Input data:", data); //…
- User
我用python代码调用js,这个是js:function result_decode(data) { console.log("Input data:", data);
// 假设 data 是 Base64 编码的字符串 var decoded_data = atob(data); console.log("Decoded data:", decoded_data); var d = Object(d1)(decoded_data); // 继续你的流程 console.log("After d1:", d); if (d === null || d === undefined) { throw new Error("d1 returned null or undefined"); } y = Object(d2)(d); console.log("After d2:", y); if (y === null || y === undefined) { throw new Error("d2 returned null or undefined"); } m = JSON.parse(y); return m;}
现在报错:JavaScript error: 'utf-8' codec can't decode byte 0xa6 in position 69: invalid start byte 我是这样调用的:result_data = context.call( "result_decode", base64.b64decode(response["d"]).decode("utf-8"), errors="ignore", )
- Assistant