[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mbox und file



* Andreas Schmidt [24-02-2018 20:57]:

> Ich bin gerade darauf gestoßen, dass file merkwürdige Ergebnisse liefert,
> wenn man Mailboxen (Format mbox -- ich habe hier keine anderen) damit prüft.
> Für eine bestimmte Mailbox wurde mir "HTML document, ISO-8859 text"
> angezeigt. Wie kommt "file" darauf, dass es sich dabei um ein HTML-Dokument
> handeln könnte? Es gibt dort tatsächlich (aber nicht ausschließlich)
> HTML-Mails, aber die erste Zeile der Datei beginnt mit "From …".

Wahrscheinlich hat das nichts mit dem Content-Type zu tun.
Hier mal eine kleine Fingerübung:

$ echo '<html></html>' > foo
$ file foo
foo: HTML document, ASCII text

$ echo '<html>hä?</html>' > foo
$ file foo
foo: HTML document, UTF-8 Unicode text
$ echo '<html></html>' >> foo
$ file foo
foo: HTML document, UTF-8 Unicode text
$ echo '<html>foo</html>' >> foo
$ file foo
foo: HTML document, UTF-8 Unicode text

$ echo '<html>foo</html>' > foo
$ file foo
foo: HTML document, ASCII text
$ echo '<html>hä?</html>' >> foo
$ file foo
foo: HTML document, UTF-8 Unicode text
$ echo '<html>foo</html>' >> foo
$ file foo
foo: HTML document, UTF-8 Unicode text
$ cat foo
<html>foo</html>
<html>hä?</html>
<html>foo</html>

$ echo 'From: foo' > foo
$ file foo
foo: news or mail, ASCII text

$ echo 'From: föö' > foo
$ file foo
foo: news or mail, UTF-8 Unicode text
$ echo '<html>foo</html>' >> foo
$ file foo
foo: news or mail, UTF-8 Unicode text

$ echo '<html>hä?</html>' > foo
$ file foo
foo: HTML document, UTF-8 Unicode text
$ echo 'From: foo' >> foo
$ file foo
foo: HTML document, UTF-8 Unicode text

Die Magie hinter file kenne ich allerdings auch nicht genau.

Gruß Uwe

Attachment: signature.asc
Description: PGP signature


Reply to: