html52.com
我爱小程序-开发者交流社区

wx.request后返回中文出现乱码,应该怎么处理?新手

wx.request({

         url: 'http://localhost:88/api/index_json.php', //仅为示例,并非真实的接口地址

      data: {

        sql_class: "Pclass",

      },

      method: "post",

      header: {

        'content-type': 'application/x-www-form-urlencoded;charset=utf-8', // 默认值   

      },

        success (res) {

        console.log(res.data)        

        that.setData({

        list_Data:res.data.rows         

        })


以上是代码

以上是代码这是返回值

这是返回值

网友回复

卡卡:

看看后台返回的是什么编码

      :

找返回数据的那家伙

จุ๊บ:

后端把中文给转成 utf8 字符了

undefined:

让后端给你返回真实字符,Lcclass Keyword,这些字段返回十六进制的字符转decode一下

xplee:

这不是乱码,是经过编码的字符,问下后端吧

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付