I met a problem that chinese characters in response would be garbled, and I found that error happened when transferred string to arraybuffer below.
const bufView = new Uint8Array(new ArrayBuffer(txt.length)); for (var i = 0; i < txt.length; i++) { bufView[i] = txt.charCodeAt(i); }
I tried to use TextEncoder to solve this problem.
const encoder = new TextEncoder(); const view = encoder.encode(txt);
Could you reproduct it and provide with any other solution?
Thanks for the good idea of this repo.
I met a problem that chinese characters in response would be garbled, and I found that error happened when transferred string to arraybuffer below.
const bufView = new Uint8Array(new ArrayBuffer(txt.length)); for (var i = 0; i < txt.length; i++) { bufView[i] = txt.charCodeAt(i); }
I tried to use TextEncoder to solve this problem.
const encoder = new TextEncoder(); const view = encoder.encode(txt);
Could you reproduct it and provide with any other solution?