获得过 0 次赞
回答过的问题获得 0 次赞
分享过的文章/案例获得 0 次赞
评论与回复获得 0 次赞
text = decodeURIComponent(escape(text));
request 中的onChunkReceived 乱码网页,postman ,接口都表现正常,开启 enableChunked: true, 后就乱码,求解 let task = wx.request({ url: 'https://xxx/api/chat/generate', enableChunked: true, method: "GET", }) task.onChunkReceived((buffer) => { // const decoder = new TextDecoder("utf-8"); // const str = decoder.decode(new Uint8Array(buffer.data)) const arrayBuffer = buffer.data; const uint8Array = new Uint8Array(arrayBuffer); let text = String.fromCharCode.apply(null, uint8Array); console.log('onChunkReceived',text) }) chrome表现 [图片] postman [图片] 后台接口 [图片] 乱码 [图片]
2023-10-26