問題分析
當響應數據或響應頁面沒有設置編碼時,Jmeter按照安裝目錄/bin/jmeter.properties中jmeter.properties文件,sampleresult.default.encoding設置的格式解析
默認ISO-8859-1,解析中文肯定出錯
例子:某請求響應數據編碼為UTF-8,通過“查看結果樹”看到響應數據為亂碼;
方案一:直接修改sampleresult.default.encoding=UTF-8。(記住去掉#,不要還是注釋狀態哦)
step1:指定請求節點下,新建后置控制器"BeanShell PostProcessor"
step2:其腳本框中輸入:prev.setDataEncoding("UTF-8");
step3:保存