jmeter 接口测试响应unicode编码为中文显示
添加一个后置处理器beanshell postprocessor,
public String resUnicoding ( String resMsg )
{
String[] asciis = resMsg.split ("\\\\u");
String nativeValue = asciis[0];
try
{
for ( int i = 1; i < asciis.length; i++ )
{
String code = asciis[i];
nativeValue += (char) Integer.parseInt (code.substring (0, 4), 16);
if (code.length () > 4)
{
nativeValue += code.substring (4, code.length ());
}
}
}
catch (NumberFormatException e)
{
return asciicode;
}
return nativeValue;
}
String asciicode =new String(prev.getResponseData(),"UTF-8");
prev.setResponseData(ascii2native(asciicode));