Questions about MIME type detection



Hi

I have some questions regarding how MIME type detection in GNOME works
in detail. I have read the specification from freedesktop.org.

How does GNOME decide if a given file is a text file? Why does GNOME
identify this file as text/plain?

> emily Cervelat:~$ gnomevfs-info -s 0131sniff | grep MIME
> MIME type         : text/plain

> emily Cervelat:~$ hd 0131sniff
> 00000000  eb 00 90 28 4b 21 2b 6b  49 48 43 00 02 01 01 00  |...(K!+kIHC.....|
> 00000010  02 e0 00 40 0b f0 09 00  12 00 02 00 00 00 00 00  |                |
> 00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> *
> 000000f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00        |..............|
> 000000fe

I think it is done by the function

_gnome_vfs_sniff_buffer_looks_like_text

in

http://cvs.gnome.org/viewcvs/gnome-vfs/libgnomevfs/gnome-vfs-mime-magic.c?rev=1.51&view=markup

It is beyond my knowledge to understand all of the C-Code. But I see a
test with two parts. Surely the shown file is not valid unicode and it
has a lot of zeros, so it should fail both parts?

Thank you

Redoute



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