频道分类

delphi 判断 文本文件 utf-8 BOM头

作者:admin 来源: 日期:2020/3/24 14:39:02 人气: 标签:

 
function UTF8FileBOM(const FileName: string): boolean;
var
  txt: file;
  bytes: array[0..2] of byte;
  amt: integer;
begin
  FileMode := fmOpenRead;
  AssignFile(txt, FileName);
  Reset(txt, 1);
  try
    BlockRead(txt, bytes, 3, amt);
    result := (amt=3) and (bytes[0] = $EF) and (bytes[1] = $BB) and (bytes[2] = $BF);
  finally    
    CloseFile(txt);
  end;
end;




https://bbs.csdn.net/topics/390275052

上一篇:delphi adoquery查询,如何得到查询记录数?下一篇:没有资料