I have just experienced a problem while trying to read a text file by vbscript. When I echo lines to screen I saw an empty line shows ÿþ, and other weird/bad characters.
Than I realized the problem is about the file's encoding. The text file I was trying to read is created by printing characters to a file. (dir c:\test.txt).
So don't forget to define encoding type while opening a file, check the three parameters below that you will use as a paramater for OpenTextFile
Open Using System Default > TristateUseDefault =-2
Open File As Unicode icin > TristateTrue=-1
Open File As ASCII icin > TristateFalse=0
Example:
Const ForReading = 1
Const TristateUseDefault=-2
Dim objFSO
Set objFile = objFSO.OpenTextFile("C:\WDSPendingDevices.txt", ForReading, True, TristateUseDefault)