一.乱码解决办法
1.jmeter中修改http请求体中信息content encoding为UTF-8
2.修改bin文件夹中jmeter.properties文件中,搜索encoding,大约是第1030行,# The encoding to be used if none is provided (default ISO-8859-1) #sampleresult.default.encoding=(修改为UTF-8)
同时去除# 注释 需要重启
3.新增post processors中的BeanShell PostProcessor。将prev.setDataEncoding("ISO-8859-1")修改为prev.setDataEncoding("utf-8"),需要重启
二、unicode转utf8展示(推荐)
1.在刚才的第三点中 添加不同的代码(记住添加的是后置处理器 而不是前置处理器 看清楚是Post)
写入的代码为:(实际上就是java写的一个代码转换)
String s2=new String(prev.getResponseData(),"UTF-8");
//---------------一下步骤为转码过程---------------
char aChar;
int len= s2.length();
StringBuffer outBuffer=new StringBuffer(len);