That means that a lot of my Visual basic scripts that operate on those files no longer work. VB Scripts can work with either Unicode or ASCII files but you need to know which type it is before you open it.
So I am posting a working script to show how I handle the problem. This is a script I am using that lets me change the settings of keys within the ini file from a VB script that has been launched in Irfanview as an External editor. The script file is what I have used before but the lines with comments against them are new (comments in a line of script start after a ' character). Basically I assume the file is Unicode, open it as that and read in the file contents. I then look for an end of line sequence (Carriage return, Line Feed) and if I cannot find one, assume that it is an ASCII file and open in that form instead (a CR,LF from an ASCII file looks like some Chinese character in Unicode).
Code:
'Drop an ini file name onto VBS file icon. Edits contents as either ASCII or Unicode text format If Wscript.Arguments.Count<>1 then Wscript.Quit Set objFSO= CreateObject("Scripting.FileSystemObject") IniFile=WScript.Arguments(0) UTF=-1 : Set myFile =objFSO.OpenTextFile (IniFile, 1, False, UTF) 'Assume to be UTF and open content=myFile.ReadAll : myFile.close 'Read whole file in UTF If instr(content,vbCrLf)=0 then UTF=0 : Set myFile =objFSO.OpenTextFile (IniFile, 1, False, UTF) 'Not UTF so open as ASCII Content=myFile.ReadAll : myfile.close 'Read whole file in ASCII End If Edit_ini Content,"WinPosition","Maximized=1" : Edit_ini Content,"Viewing","ViewAll=0" 'This line calls the subroutine Edit_ini Set myFile =objFSO.OpenTextFile (IniFile, 2, False, UTF) 'Open for writing as original type myFile.write content : myFile.close 'Write whole file as original type Set ObjFSO=Nothing : WScript.Quit Sub Edit_ini (strAll,header,entry) Eq=Instr(1,entry,"=") : key=left(entry,Eq) : header= "[" & header & "]" b1=instr(strAll,header) If b1=0 then strAll=strAll & header &vbCrLf & entry &vbCrLf else b2=instr(b1+1,strAll & "[",vbCrLf&"[") : e1=instr(b1,strAll,key) If e1=0 then strAll=left(strAll,b2+1) & entry & right(strAll,len(strAll)-b2+1) else e2=instr(e1,strAll,vbCrLf) : old_entry = mid(strAll,e1,e2-e1) strAll=replace(strAll,old_entry,entry) End If End If End sub