zoukankan      html  css  js  c++  java
  • 获取各种编码的识别符


    下面是常用编码的识别符, 在 Delphi(2009) 中如何获取呢?
    Unicode: FF FE; BigEndianUnicode: FE FF; UTF8: EF BB BF

    var
      bs: TBytes;
      b: Byte;
      str: string;
    begin
      {只有 Unicode、BigEndianUnicode、UTF8 编码有识别符}
      bs := TEncoding.Unicode.GetPreamble;
      str := '';
      for b in bs do str := Format('%s %x', [str, b]);
      ShowMessage(str); {FF FE}
    
      bs := TEncoding.BigEndianUnicode.GetPreamble;
      str := '';
      for b in bs do str := Format('%s %x', [str, b]);
      ShowMessage(str); {FE FF}
    
      bs := TEncoding.UTF8.GetPreamble;
      str := '';
      for b in bs do str := Format('%s %x', [str, b]);
      ShowMessage(str); {EF BB BF}
    
      {ASCII、UTF7 和 Default(默认编码) 没有识别符}
      bs := TEncoding.ASCII.GetPreamble;
      str := '';
      for b in bs do str := Format('%s %x', [str, b]);
      ShowMessage(str); {无}
    
      bs := TEncoding.UTF7.GetPreamble;
      str := '';
      for b in bs do str := Format('%s %x', [str, b]);
      ShowMessage(str); {无}
    
      bs := TEncoding.Default.GetPreamble;
      str := '';
      for b in bs do str := Format('%s %x', [str, b]);
      ShowMessage(str); {无} 
    end;
    
  • 相关阅读:
    Shell基础
    个人对JavaScript预编译的理解
    文件系统管理
    文件特殊权限
    权限管理ACL权限
    用户和用户组管理
    RPM包管理-yum管理
    oracle11g完全卸载方法
    JVM概述
    复杂查询优质习题
  • 原文地址:https://www.cnblogs.com/del/p/1336798.html
Copyright © 2011-2022 走看看