Forum Discussion

harshdip_singh's avatar
harshdip_singh
Occasional Contributor
13 years ago

Encoding Options In Test Complete

I am retrieving some text from a source using test complete 8.20.



Is there any way through test complete that we can know the encoding of the source text ?



Or Does Test Complete allow any encoding options of the retrieved text ?

2 Replies

  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 2 rankChampion Level 2
    Hi Harshdip,



    I don't remember exactly for TC8.20, but for TC8.70 and up you can set encoding for the script units via Character Encoding property of the project (http://support.smartbear.com/viewarticle/30056/).

    To determine the encoding during run-time, you can either use the aqFile.OpenBinaryFile() method (http://support.smartbear.com/viewarticle/27841/) and read the first several bytes of the file to determine its encoding type, or to use the code like this (which, basically, does the same but using native OS means; JScript):

    function isUnicode(fileName)

    {

      var fso = new ActiveXObject("Scripting.FileSystemObject");

      var aFile = fso.OpenTextFile(fileName, 1, false, 0);

      var flag = aFile.Read(2)

      aFile.Close();

      var template = String.fromCharCode(1103, 1102);

      if (flag == template) return true;

      return false;

    }


  • Hi Harshdip,


     


    There is no such option in TestComplete. However, you can call some third-party utility (I've googled it) from TC.