function encodeString(str) {
if (globalThis.wx && globalThis.wx.encode) {
return new Uint8Array(globalThis.wx.encode({
data: str || "",
format: 'utf8'
}));
}else if (globalThis.tt && globalThis.tt.createBuffer) {
console.log("小白Str:", str);
var Buffer = globalThis.tt.createBuffer();
var tempBuffer = Buffer.from(str, 'utf8');
console.log("小白tempBuffer:", new Uint8Array(tempBuffer));
return new Uint8Array(tempBuffer);
} else {
return window.encoder(str);
}
}
安卓系统正常运行
IOS系统运行失败
