Sub CheckTextCodingType(Textfile) Set fl = aqFile.OpenBinaryFile(Textfile,aqFile.faRead) Binary1 = fl.ReadByte() Binary2 = fl.ReadByte() fl.Close select case CStr(Binary1)& CStr(Binary2) case 255254: '*Unicode (UTF-16) 前两个字节为FFFE Log.Message("file is ctUnicode type") TextCodingType = 21 case 239187: '*UTF8 前两字节为EFBB Log.Message("file is ctUTF8 type") TextCodingType = 22 case else Log.Message("file will open via ANSI type") TextCodingType = 20 end select End Sub