LoadRunner Chinese garbled problem solving method

Source: Internet
Author: User

LoadRunner Chinese garbled problem solving method

Previous time in recording, enhancement, integration LoadRunnerScript, during two times encountered the problem of Chinese garbled. Here to record the problem of Chinese garbled solution. first, recording playback Chinese garbledI recorded the login script, the user name appears in Chinese, the playback is always prompted to login failure. such as: Figure 1 LR playback Chinese garbled to solve the Chinese garbled can be recorded in the virtual User gen Tools->recoding Options, advanced, support CharSet-UT F-8. After re-recording the Chinese garbled problem is resolved. second, the integration script Chinese garbledRecording enhancements (parametric, associative, checkpoint, transactional) scripts decided to combine several scripts. A new empty script is created, and the log-out common operation is placed in Vuser_init and Vuser_end, and other actions are placed in the respective action. After finishing the playback, Chinese garbled characters appear.  To solve this problem, the most important thing is to convert native GBK encoded Chinese characters into UTF-8 encoded format, for which we introduce LoadRunner encoded function lr_convert_string_encoding. int lr_convert_string_encoding (const char *sourcestring, const char *fromencoding, const char *toencoding, const char *P Aramname); the function has 4 parameters, meaning the following:Sourcestring: The source string being converted.  Fromencoding: The character encoding before conversion.  Toencoding: The character encoding to convert into. ParamName: the converted target string. Practice a: lr_convert_string_encoding ("Login", Lr_enc_system_locale, Lr_enc_utf8, "account");  Web_submit_data ("Login.quick", ...)  "Name=account", "Value={account}", Enditem, ...  last); Still error when playing back the script. View Lr_convert_string_encoding's explanation, which adds \x00 at the end of its converted string. In the C language, \x00 is the end of a string, and it is the presence of this \x00 that causes the script to replay unsuccessfully. Practice Two
Char tmp[100];lr_convert_string_encoding ("Login", Lr_enc_system_locale, Lr_enc_utf8, "account"); strcpy (Tmp,lr_eval_ String ("{account}"); Lr_save_string (TMP, "account"); Web_submit_data ("Login.quick",...... "Name=account", "value={ Account} ", Enditem,...... last);
Through the treatment of strcpy and lr_save_string the effects of shielding \x00, TestResults are normal.

LoadRunner Chinese garbled problem solving method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.