lr_convert_string_encoding函数说明中标红的说明:The function saves the result string, including its terminating NULL, in the parameterparamName.
也就是说,我转换成UTF-8之后,如果直接作为变量传到代码之中的话,在最后的字符串之中,会多出来一个“NULL”,
Action()
{
//首先使用lr_convert_string_encoding 对请求的字符串转码,转换后会多出一个'NULL'
lr_convert_string_encoding( "南",
LR_ENC_SYSTEM_LOCALE,
LR_ENC_UTF8,
"temkeyword" );
lr_save_string(lr_eval_string("{temkeyword}"),"keyword");
//使用web_reg_save_param方法保存服务器返回的参数
web_reg_save_param ("S_respond","LB=","RB=",LAST);
//请求接口
web_submit_data("jiekou",
"Action=http://v.juhe.cn/cccn/to_telecodes.php",
"Method=POST",
"TargetFrame=",
ITEMDATA,
"Name=key", "Value=558ccc4604512exxxxxxxxx", ENDITEM,
"Name=chars", "Value={keyword}", ENDITEM,
LAST );
//对返回的字符串转码,转码后的值存在msg中
lr_convert_string_encoding(lr_eval_string("{S_respond}"),LR_ENC_UTF8,NULL,"msg");
//打印转码后的响应报文
lr_output_message(lr_eval_string("{msg}"));
}