Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#8

Re: Textfile als solches erkennen

  Alt 1. Sep 2009, 02:17
Zitat von martinf16:
Okay, wenn ich die Links jetzt richtig interpretiere heißt das, dass die normalen Textfiles, die ich prüfen möchte eigentlich gar nicht prüfbar sind, da sie kein BOM enthalten, stimmts?
Fast. In den Links geht es darum, dass Textdatei nicht gleich Textdatei ist, da sie unterschiedlich kodiert sein können. Das hat nur am Rande mit der BOM zu tun.


Zitat:
if DateiAnfang[I] //wie kann man hier weitermachen?!
Gar nicht. Lies dir noch mal die Links durch. Insbesondere das:
Zitat:
Here's the file "Hello" in various encodings:

48 65 6C 6C 6F

This is the traditional ANSI encoding.
48 00 65 00 6C 00 6C 00 6F 00

This is the Unicode (little-endian) encoding with no BOM.
FF FE 48 00 65 00 6C 00 6C 00 6F 00

This is the Unicode (little-endian) encoding with BOM. The BOM (FF FE) serves two purposes: First, it tags the file as a Unicode document, and second, the order in which the two bytes appear indicate that the file is little-endian.
00 48 00 65 00 6C 00 6C 00 6F

This is the Unicode (big-endian) encoding with no BOM. Notepad does not support this encoding.
FE FF 00 48 00 65 00 6C 00 6C 00 6F

This is the Unicode (big-endian) encoding with BOM. Notice that this BOM is in the opposite order from the little-endian BOM.
EF BB BF 48 65 6C 6C 6F

This is UTF-8 encoding. The first three bytes are the UTF-8 encoding of the BOM.
2B 2F 76 38 2D 48 65 6C 6C 6F

This is UTF-7 encoding. The first five bytes are the UTF-7 encoding of the BOM. Notepad doesn't support this encoding.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat