Loadrunner11 中文转码

Action()
{
    //中文转码定义char,char必须定义在脚本开始前
    char tmp[50];

    web_add_header("Content-Type","application/xml;charset=utf-8");   

    //中文转码
    lr_convert_string_encoding( "哈哈",
                      LR_ENC_SYSTEM_LOCALE,
                               LR_ENC_UTF8,
                                "str" );  
    strcpy(tmp,lr_eval_string("{str}"));

    web_custom_request("web_custom_request",
        "URL=",
        "Method=POST",
        "Resource=0",
        "RecContentType=application/xml",
        "Mode=HTTP",
        "EncType=application/xml;charset=utf-8",        
        "Body="
      
        LAST);
    return 0;
}

猜你喜欢

转载自blog.csdn.net/At_Swim/article/details/86132526
今日推荐