MIME subclasses

Thomas Leonard tal00r at ecs.soton.ac.uk
Sat Oct 4 16:19:05 EEST 2003


On Fri, Oct 03, 2003 at 09:59:16PM +0200, David Faure wrote:
> On Friday 03 October 2003 21:15, Jonathan Blandford wrote:
> > Perhaps a system where we returned a multiple mime-types
> > depending on what attributes the file has makes more sense.
> 
> I like this idea very much.

Meaning that we run *all* the magic patterns, and return all matching
types? That could work. So if a file contains no control characters at the
start then it's always reported as 'text/plain', but it could also be
'text/xml' if it starts '<?xml' and maybe 'text/xhtml' too, if the root
element is set for that. So:

	get_type("index.xhtml")
returns
	['text/xhtml', 'text/xml', 'text/plain', 'application/octet-stream']

And the ordering information is presumably the same as the priority (since
the highest priority match is what we would have returned as the single
answer before). And this doesn't require any changes to either the
database itself or to update-mime-database.

> But this is indeed very good for all the gzipped formats (like .ps.gz etc.).
> (Yes, at the moment we have x-postscript and x-gzpostscript, and that sucks.)

This is slightly different, though. There's a difference between a
postscript file which has been gzipped, and an office file which is
also a gzip file.

The reason being, we can't have 'README.gz' reported as 'text/plain' and
sent directly to a text editor. The set of applications that can handle
README.gz is different to the set that can handle README.txt, so we need
different types (or an encoding field, which amounts to the same thing).

It's not too bad with the above system though. If I click on report.ps.gz
then I will see two sets of programs: compressed-postscript viewers (due
to application/x-gzpostscript), and decompressers (due to
application/x-gzip). If no application can read it directly, I click on
the decompresser and the decompressed file appears ready to be dragged (or
whatever) to the reading application.


-- 
Thomas Leonard			http://rox.sourceforge.net
tal00r at ecs.soton.ac.uk	tal197 at users.sourceforge.net
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1



More information about the xdg mailing list