问题表象:
1、在PUT请求中使用中文,请求响应中put data 和 响应结果均出现乱码问题。
2、使用post请求确没有出现乱码!
解决问题过程:
1、使用网上的办法:修改jmeter.properties 文件中sampleresult.default.encoding=utf-8 但是并未生效。(或者说只对post方法生效了)
2、使用网上方法:(未生效)
- 为HttpSampler新建后置控制器”BeanShell PostProcessor”
- 其脚本框中输入:prev.setDataEncoding(“UTF-8”);
3、搜到参考资料:https://blog.csdn.net/u012167045/article/details/70868306
3.1单独对put 这个请求设置content encodding 设置为UTF-8(图1处),发现响应数据不再是乱码(图2处)。但是请求中PUT DATA还是显示乱码(图3处)。
3.2 继续设置implementation 为JAVA,再次请求发现所有地方均显示正确。
遗留问题,
1、jmeter.properties 中sampleresult.default.encoding=utf-8 难道是只针对post请求生效??
2、是否可以通过源码反编译设置UTF-8.(尝试过但是再次编辑时报错。)
3、jmeter中Implementation中几个选项的区别 :只找到这个参考文章:http://www.bubuko.com/infodetail-1561861.html 待后续观察源码