Jmeter---响应中中文没有解析

 

添加后置处理器----BeanShell PostProcessor,添加以下代码:

private static String ascii2native ( String asciicode )
{
    String[] asciis = asciicode.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));

 

Jmeter---响应中中文没有解析

 

再次运行后,响应代码:

Jmeter---响应中中文没有解析 

相关文章:

  • 2022-12-23
  • 2022-02-14
  • 2021-12-03
  • 2021-09-06
  • 2021-06-04
  • 2022-12-23
  • 2021-07-26
  • 2022-01-19
猜你喜欢
  • 2022-12-23
  • 2021-08-12
  • 2021-06-28
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2021-10-06
相关资源
相似解决方案