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

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

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

posted on 2020-05-21 14:29  西风瘦马justin  阅读(4648)  评论(0编辑  收藏  举报