ArrayBuffer转换成字符串中文乱码问题

  buf2str(buffer) {
      
      let  encodedString = String.fromCodePoint.apply(null, new Uint8Array(buffer));
      let decodedString = decodeURIComponent(escape(encodedString));//没有这一步中文会乱码
      console.log(decodedString);
      return decodedString
    },

  时间紧迫,请看代码。亲测有效

猜你喜欢

转载自www.cnblogs.com/justinwxt/p/12930582.html
今日推荐