Jmeter之Sampler响应结果编码修改(解决乱码问题)

问题分析

当响应数据或响应页面没有设置编码时,jmeter会按照jmeter.properties文件中,sampleresult.default.encoding设置的格式解析

默认ISO-8859-1,解析中文肯定出错

  1. # The encoding to be used if none is provided (default ISO-8859-1)  
  2. #sampleresult.default.encoding=ISO-8859-1  


方案一:直接修改sampleresult.default.encoding=UTF-8。(记住去掉#,不要还是注释状态哦)

方案二:动态修改(这种方法方便些,蜗牛推荐)

   step1:指定请求节点下,新建后置处理器"BeanShell PostProcessor"

   step2:其脚本框中输入:prev.setDataEncoding("UTF-8");

   step3:保存


版权声明:本文为wuyepiaoxue789原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。