LoadRunner中文出现乱码的解决办法

录制选项,高级,支持字符集,UTF-8。

一般情况下不需要开启此选项,否则在Submit里会出现有乱码。
如果未开启此功能还出现乱码,可尝试开启此选项。

如果开启此选项还是有乱码,且乱码处的内容你需要进行参数化,可使用lr_convert_string_encoding函数将字符转化为你需要的模式。

函数原型:

int lr_convert_string_encoding ( const char *sourceString, const char *fromEncoding, const char *toEncoding, const char *paramName);

sourceString

The string to convert

fromEncoding

The encoding of the sourceString

toEncoding

The encoding to convert of the string saved in parameter paramName

paramName

The name of the parameter in which the destination string will be saved

Constant Value

LR_ENC_SYSTEM_LOCALE

NULL

LR_ENC_UTF8

"utf-8"

LR_ENC_UNICODE

"ucs-2"


浏览器也有转码功能:菜单“查看”-->编码-->Unicode(UTF-8)

为什么要启用UTF-8,某些请求中会出现:

web_custom_request("CALL-H001I",
        "EncType=text/xml; charset=UTF-8",
……);


这时候,此函数你就派得上用场了!

lr_convert_string_encoding函数的使用,直接查看帮助即可。

说明:
1. 在树视图里的源码(server Response)的乱码是没法解决的;
2. 在树视图的页面显示可以是正常,源码视图也可以显示正常;
3. 虽然在server Response显示乱码,但查找中文字符串还是正常的



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章