LR乱码转中文

1,通过方法转换乱码。 

void LR_ENC_UTF8_to_LR_ENC_SYSTEM_LOCALE(){


 lr_convert_string_encoding("鏈?" ,LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE ,"param");

 lr_output_message("打印结果是:%s",lr_eval_string("{param})"));

}


Action()

{


   LR_ENC_UTF8_to_LR_ENC_SYSTEM_LOCALE();


return 0;

}





2,返回值直接转乱码

找了很多方法,utf-8也设置了,还是不行,只有有转码方法了

web_reg_save_param("res2",
"LB=\"msg\":\"",
"RB=\"",
"Search=Body",
LAST);

lr_start_transaction("Web_注册_register_bean");

web_custom_request("web_custom_request",
"URL=http://{ip}/api/user/register",
"Method=POST",
"Resource=0",
"RecContentType=application/json",
"Referer=",
"Mode=HTTP",
"EncType=application/json",
"Body={\"username\":\"131{NewParam}\",\"password\": \"123456\"}",
LAST);


lr_convert_string_encoding(lr_eval_string("{res2}"),"utf-8",NULL,"msg");//将返回消息responseMsg值做编码转换 

lr_output_message("转换编码后msg----%s",lr_eval_string("{msg}")); 
if(strcmp(lr_eval_string("{msg}"),"注册成功")==0)

 

其实很简单,就是把原来返回的字符串res2,通过转码变成新的字符串msg.

再通过新的字符串msg与实际返回值进行比较


猜你喜欢

转载自blog.51cto.com/13693838/2418936
0条评论
添加一条新回复