uniapp 微信小程序蓝牙接收中文乱码
- cmd到当前工程目录使用NPM安装fast-text-encoding包
npm install fast-text-encoding - JS里import ‘fast-text-encoding’;
- 接收逻辑采用
const decoder = new TextDecoder(‘utf-8’);
value = decoder.decode(new Uint8Array(res.value));
this.addLog(‘接收’, value);
实测微信小程序中文正常了