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;