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


本文整理自网络,侵删。

 
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 android调用授权管理打开通知监听服务

Delphi里面控制edit只能输入数字

Delphi获取星期几

Delphi中如何捕获mediaplayer播放的视频中的每一帧 ?

Delphi中读取硬盘的物理序列号

Delphi 从dbgird中导出到excel

embarcadero开源项目赞助

Delphi 62 进制的简单实现

webbrowser点击没有id和name的按钮或链接

Delphi整理五(枚举、子界、集合)

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...