Code: Select all
f:=FileOpen(file,"rw")
Chars:={}
loop
{
Chars.Insert(f.ReadUChar())
} until f.AtEOF
MsgBox % Chars[1] "`n" Chars[2]
but use the code read the Unicode16BE file, BOM Head read right --- 0xFEFF (254 255)
Code: Select all
f:=FileOpen(file,"rw")
Chars:={}
loop
{
Chars.Insert(f.ReadUChar())
} until f.AtEOF
MsgBox % Chars[1] "`n" Chars[2]
https://autohotkey.com/docs/commands/FileOpen.htm wrote:When a file containing a UTF-8 or UTF-16 byte order mark (BOM) is opened with read access, the BOM is excluded from the output by positioning the file pointer after it. Therefore, File.Position may report 3 or 2 immediately after opening the file.
Code: Select all
f.Seek(0)
I've use the codeFlipeador wrote:https://autohotkey.com/docs/commands/FileOpen.htm wrote:When a file containing a UTF-8 or UTF-16 byte order mark (BOM) is opened with read access, the BOM is excluded from the output by positioning the file pointer after it. Therefore, File.Position may report 3 or 2 immediately after opening the file.?Code: Select all
f.Seek(0)
Code: Select all
f:=FileOpen(file,"rw"), f.Pos:=0
,Chars:={}
loop
{
Chars.Insert(f.ReadUChar())
} until f.AtEOF
MsgBox % Chars[1] "`n" Chars[2]
Users browsing this forum: Google [Bot] and 117 guests