python 解决微信客服接口发送文本消息中文乱码的问题
1,客户要求用户在点击某个按钮触发一个客服发送文本的要求,(原先发图片没遇到乱码的问题)结果一发一乱码。。。效果如下
2 更改代码如下
url='https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=%s'%abcer['token']
datas={
"touser":user.openid,
"msgtype":"text",
"text":{"content":"您好,请点击下方的“在线客服”按钮开始咨询哦~"}
}
data = json.dumps(datas, ensure_ascii=False).encode('utf-8')
r=requests.post(url,data=data)
3,改完效果如下