Read from a doc

HI all,
I need help please.
Actually since one day I was able to read data from a text document to run my scripts.
But i have just ried now and got this message, I dont know what to do
.
STFileException
File C/Users/dmbenda/Documents/Documents/LoginValuelp.txt couldn't be read using the defaultStringEncoding (UTF8

Thank you

Comments

  • EggplantMattEggplantMatt ForumAdmin admin
    The file is not in UTF8 format. eggPlant supports many file encodings via the "the defaultStringEncoding" global variable. You can find out what the supported encodings are on your platform by running this code:
    put the availableStringEncodings
    
    I would try the Unicode encoding:
    put the defaultStringEncoding into DSE // store the current setting
    set the defaultStringEncoding to "Unicode" // set it to Unicode
    put file "myfile" into myvar // read the file however you are doing it
    set the defaultStringEncoding to DSE // restore the original value
    
    If Unicode doesn't work, then you'll need to just try the other available encodings one at a time until you find one that does. If you're so inclined, you can write code to loop through the values returned by "the availableStringEncodings" and test each one until one works.
  • Thanks Matt fpor the answer, I have tried the code but what it does is just entering the data "myfile" , it doesnot actually read the data inside my file and does not throw me an error message at the same time.

    I am still confused.
    If instead of a text document, i move my data to an excel sheet, will I have the same problem?
    If not Please Help me with the code to convert excel sheet in csv and call it on my script.

    Thank you
  • Actually, I have created an excel document and then save it as .csv file,
    And reading from it , it works.

    Thanks again Matt.
Sign In or Register to comment.