Using Tesseract-OCR in TestComplete
Hi SmartBear Community,
I Use Tesseract for OCR texte recognition ,
It works very well with to generate the .TXT file.
When the .TXT file is created, I read it with this Python script :
Path = "D:\\TESTOCR\\Text.txt"
myFile = aqFile.OpenBinaryFile(Path, aqFile.faRead)
Log.Message("Ligne 1: "+ myFile.ReadString(1))
Log.Message("Ligne 2: "+ myFile.ReadString(2))
Log.Message("Ligne 3: "+ myFile.ReadString(3))
In the .TXT file, I have English sentences, and I don't understand why I Have this Chinese ones in the log :
Tesseract use UTF-8 , so it should works ! 🤔
Someone have any idea ?
Thank you all !
It works, problem solved ! I have found with this method :
sPath = "D:\\TESTOCR\\Text.txt"
myFile = aqFile.OpenTextFile(sPath, aqFile.faRead, aqFile.ctANSI)
lNum = myFile.LinesCount
for i in range(0, lNum):
curLine = myFile.Line + 1
Log.Message("The " + str(curLine) + " line is:")
Line = myFile.ReadLine()
Log.Message(Line)