qileilove

          blog已經轉移至github,大家請訪問 http://qaseven.github.io/

          LoadRunner腳本開發-字符串編碼轉換

           相關函數
            lr_convert_string_encoding函數
            功能:字符串編碼轉換
            原型:
            int lr_convert_string_encoding(const char *sourceString, const char *fromEncoding, const char *toEncoding, const char *paramName);
            返回值:0(執行成功)、-1(執行失敗)
            參數說明:
            sourceString:要轉換的字符串
            fromEncoding:源字符的編碼
            toEncoding:保存在參數parmaName中的字符串編碼,即要轉換的目標編碼
            paramName:保存轉換編碼后的字符串
            說明:
            1.lr_convert_string_encoding支持system locale,Unicode,UTF-8字符串編碼的相互轉換,參數paramName中保存結果字符串,該結果字符串包含字符串結束符NULL
            2.結果字符串中的可打印字符在VuGen和日志中按實際字符顯示,不可打印字符則以十六進制顯示,例如:
            rc = lr_convert_string_encoding("A", NULL, LR_ENC_UTF8, "stringInUnicode");
            結果字符串(即stringInUnicode參數值)顯示為:A\x00, 而不是\x41\x00,因為A為可打印字符串.
            3.fromEncoding and toEncoding可選值:
            loadrunner <wbr>腳本開發-字符串編碼轉換
            例子:
          Action()
          {
          int rc = 0;
          char *converted_buffer_unicode = NULL;
          rc = lr_convert_string_encoding("hello", NULL, LR_ENC_UNICODE, "stringInUnicode");
          if(rc < 0)
          {
          lr_output_message("convert_string_encoding failed ");
          // error
          }
          return 0;
          }
            輸出結果:

          posted on 2014-12-03 13:44 順其自然EVO 閱讀(1006) 評論(0)  編輯  收藏 所屬分類: loadrunner

          <2014年12月>
          30123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          導航

          統計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 萨迦县| 保康县| 称多县| 芒康县| 武功县| 德庆县| 和林格尔县| 达尔| 怀远县| 甘孜县| 准格尔旗| 治县。| 潢川县| 老河口市| 浠水县| 安溪县| 海门市| 石嘴山市| 祥云县| 邵阳县| 香港 | 尚义县| 临沭县| 定襄县| 玉树县| 东台市| 潞城市| 长寿区| 运城市| 莒南县| 得荣县| 论坛| 潞城市| 莱芜市| 罗平县| 称多县| 宜兰市| 大宁县| 芜湖县| 密山市| 和林格尔县|