How to find a file's mailcap "content type"?

Peter Flynn peter at silmaril.ie
Mon Oct 28 22:20:06 UTC 2019


On 28/10/2019 21:55, Chris Green wrote:
> How can one find what mailcap "content type" corresponds to a file's
> actual format?
> 
> Some are quite obvious as the default file type suffix matches the
> seconds field of the mailcap content type, but this isn't always so.

You mean like application/pdf? That's not a reliable guide.

> For example there don't seem to be single, obvious entries for MS Word
> .doc or .docx files.

My /etc/mailcap contains the two single entries:

 >> grep '%s\.doc[x]*$' /etc/mailcap
>> application/vnd.openxmlformats-officedocument.wordprocessingml.document; soffice --nologo --writer '%s'; edit=soffice --nologo --writer '%s';test=test -n "$DISPLAY"; description="Office Open XML Document";nametemplate=%s.docx
>> application/msword; soffice --nologo --writer '%s'; edit=soffice --nologo --writer '%s'; test=test -n "$DISPLAY"; description="Microsoft Word Document"; nametemplate=%s.doc

See RFC 6838 (Media Type Registration) January 2013, section 3.2 Vendor 
Tree for details of how commercial and industrial vendor-related 
products are registered using the "vnd." facet.

In the case of Microsoft Office Open XML (MS-Office) and OASIS 
OpenDocument XML (eg LibreOffice) file formats (and others) the picture 
is muddied by the fact that the file format is actually ZIP, but the 
documents are typically opened using application products.

Peter




More information about the ubuntu-users mailing list