解决loadrunner 脚本和replaylog中的中文乱码问题

上一篇 / 下一篇  2012-04-26 17:37:23 / 个人分类:性能测试

解决这个问题必须认识到一个事实就是,loadrunner测试服务器交换数据使用的是utf8格式,但是展现在replaylog中是使用gb2312格式,而且在脚本中如何使用web_reg_find的时候也是使用的是gb2312格式,所以知道这个原理后,事情就好办多了。

1.获取测试服务器提供的utf8格式的文字并且转换成gb2312格式展现出来
        web_reg_save_param_ex(
          "ParamName=aa",
          "LB=ProductName",
          "RB=ProductBriefName",
          "NotFound=warning",
          SEARCH_FILTERS,
          LAST)     ;    


     web_url("web_url",
          "URL=http://124.238.214.65:70/Scripts/Home/HomeHotProduct.js",
          "TargetFrame=",
          "Resource=0",
          "Referer=",
          LAST);
    lr_convert_string_encoding(lr_eval_string("{aa}"),"utf-8","gb2312","str");
lr_output_message(lr_eval_string("{str}"));



2.本地的gb2312的中文经过转换成utf8发给测试服务器

       lr_convert_string_encoding(lr_eval_string("智能手机"),"gb2312","utf-8","a1");
          web_reg_save_param_ex(
          "ParamName=aa",
          "LB={a1}",
          "RB=",
          "NotFound=error",
          SEARCH_FILTERS,
          LAST);

          web_url("IndexCategoryProductJson.js",
          "URL=http://124.238.214.65:70/Scripts/Home/IndexCategoryProductJson.js",
          "Resource=1",
          "RecContentType=application/x-javascript",
          "Referer=http://124.238.214.65:8081/",
          "Snapshot=t24.inf",
          LAST);







TAG: 乱码 LoadRunner loadrunner

 

评分:0

我来说两句

Open Toolbar