其他分享
首页 > 其他分享> > 接口测试中读取excel中的请求数据含有中文问题,UnicodeEncodeError: 'latin-1' codec can't encode character &

接口测试中读取excel中的请求数据含有中文问题,UnicodeEncodeError: 'latin-1' codec can't encode character &

作者:互联网

错误信息:UnicodeEncodeError: 'latin-1' codec can't encode character '\u5c0f' in position 31: Body ('小') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8的错误

原因:从excel中读取你的接口请求数据时带有中文时在发送求情时会出现上述错误。只需要将请求数据转化为bytes类型即可

标签:latin,character,excel,codec,UnicodeEncodeError,encode
来源: https://www.cnblogs.com/vevian/p/11072357.html