application/octet-stream is returned for text files
Submitted by Tomeu Vizoso
Assigned to Jonathan Blandford Blandford @jrb
Description
xdg_mime_get_mime_type_for_file() returns application/octet-stream for files without a recognized extension.
If I understand correctly the spec, some effort should be done to distinguish between binary files and text files:
"If nothing matches, the default type of application/octet-stream should be used for binary data, or text/plain for textual data. Checking the first 32 bytes of the file for ASCII control characters is a good way to guess whether a file is binary or text, but note that files with high-bit-set characters should still be treated as text since these can appear in UTF-8 text, unlike control characters."
gnomevfs does this in _gnome_vfs_get_mime_type_internal(), calling _gnome_vfs_sniff_buffer_looks_like_text().