情景:在练习过程中,模拟请求一个接口,在返回中,中文乱码
代码如下
web_reg_save_param("response",
"LB={",
"RB=}",
"Search=All",
"Ord=All",
LAST);
web_url("Hit the Slopes and Save",
"URL=http://api.k780.com:88/?app=life.postcode&appkey=38067&sign=2b8b7baa13bd02f61399f87fd0ae5a0e&postcode=528400",
"TargetFrame=Main",
"Resource=0",
"Mode=HTML",
LAST );
// 转换之前输出
lr_output_message("%s",lr_paramarr_random("response"));
// 手动转换后输出
lr_convert_string_encoding(lr_paramarr_random("response"),"utf-8",NULL,"msg");
lr_output_message("%s",lr_eval_string("{msg}"));
运行结果:
Starting iteration 1.
Starting action Action7.
Action7.c(3)