MimeMap
Chris Hall (132) 3558 posts |
In general, when you ask for a new RISC OS file type registration you will not automatically prompt a revision to the standard HardDisc4 MimeMap file. A good example of this was the file type for .xlsx (Microsoft ExcelX) – no RISC OS application was initially able to load and display such files but a MimeMap entry was needed if such files were to be sent as an e-mail attachment or downloaded under RISC OS. It would also be necessary if you wanted to use external filing systems such as LanMan98 without the system tacking on a ,xxx suffix. Another example is an ‘Anquet Export Format’ (.aef) file for which I shall have to make up a pseudo IANA filetype for the &A6F RISC OS filetype. Unfortunately the MimeMap module was invented after the PRMs had been published and so there is very little documentation and no documentation at all about the SWI to check for a particular entry. There is (so far) no SWI to add an entry to the user’s MimeMap file. My web service provider uses a non-standard MimeMap definition for a zip file: ‘application/x-zip-compressed’ (the ‘x-’ bit means that it is a made up description rather than a standard one which is why there are so many different variants foir a .zip file) and so any zip file downloaded from my web site will have a ‘.zip’ suffix and an IANA ‘file tpye’ as given. Some Browsers are clever enough to work out common RISC OS file types (e.g. Webster) from the ‘.xxx’ suffix but other Browsers are even cleverer (such as Netsurf) and get it wrong. It doesn’t help that one of the last entries in the MimeMap file matches any unknown IANA (or non-IANA) filetype with &FFD (Data). If a file is downloaded under a non-RISC OS operating system, it will simply be saved as ‘filename.typ’ and therefore seen, from RISC OS, with the correct filetype as there will be non IANA filetype to consider. It was a long time before I realised that this simpler method would not work for e-mail attachments – for example a file ‘name.doc’ attached to an e-mail might be seen as a text file on some systems rather than as a Word file and thus be unintelligible. I am working on a method to update a user’s MimeMap file to include a specific entry (pending this facility being added to the OS) that will work on both VRPC and non-emulated systems:
this will correct the user’s MimeMap file. It doesn’t work correctly yet as it appends a line after the ‘match all’ line and the syntax of the SWI call is currently unknown so I may not have got it exactly correct – MimeMap_Translate is not documented in the PRM nor on the ROOL web site. |
Chris Mahoney (1684) 2165 posts |
MimeMap_Translate wants: I can’t remember what this all means or where I found the docs, but that’s what I’m doing in HTTPLib and it works correctly. |
Sprow (202) 1158 posts |
It’s in the StrongHelp manuals at least. I appear to have updated the list of translate types in September 2018, but even winding back to the 1999 version there was an outline of the SWI then too – the InetSWIs manual is also on RISC OS Pi of course. |
Chris Hall (132) 3558 posts |
Many thanks. I’ll have a look. |
Rick Murray (539) 13850 posts |
Would it not be better to tell your provider that they’re wrong? http://www.iana.org/assignments/media-types/media-types.xhtml |
Chris Hall (132) 3558 posts |
Would it not be better to tell your provider that they’re wrong? I do plan to do that as well. |
Martin Avison (27) 1494 posts |
That will not help – it is is the syntax of the MimeMap file which you would need, as that is read and interpreted by the MimeMap module so that it can provide the MimeMap_Translate SWI call. And the only doc I can find of the file format are the brief comments at the start of the RO5 file. |
Charles Ferguson (8243) 427 posts |
The MimeMap SWI, and the file format have been documented since at least 2006 – I’m pretty sure they were included in my MimeMap module’s distribution, ANT’s documentation and the documentation supplied by Acorn later as well. http://www.riscos.com/support/developers/riscos6/networking/mimemap.htmlThere was certainly a library for merging the MimeMap files in Select, as I recall. It was hastily put together and didn’t handle some cases very well, but it certainly was there. The example code given by the original poster is incorrect in its accessing the choices files. There are a number of problems with it…
BUT… those comments notwithstanding, the actual location of the MimeMap file is held in `<Inet$MimeMappings>`, which is what you should update. For historic reasons this variable contains a path variable – `InetDBase:MimeMap` – ( On Select, if multiple paths are used the $Write variant will be selected, so if you do the ‘open, read the file, close, open, write the file, close’ sequence, it’ll work just fine. On other systems, unless similar changes will happen, the path variable is not able to be updated reliably when given multiple elements. Additionaly, as mentioned by others, `application/x-zip-compressed` is just wrong, so you probably shouldn’t be trying to update it automatically in the MimeMap file. The `x-` prefix has been deprecated since oh, 2010-ish? The x- prefix (and it’s ‘modern’ counterpart `x.`) are ‘reserved for experimental use’. So just do it by hand. There is a standard registered mime type for zip files – application/zip – which has been around since the early 90s (probably in the original batch of registered types), so it might be time to update the software to catch up. |
Chris Hall (132) 3558 posts |
I did ask for some advice from ROOL > Is there a recommended way to ‘merge’ a new definition into a user’s and their reply (on Sat, 15 Oct 2016 00:54:45 +0100) was: Well, the comments in the MimeMap file suggest that the first non |
David J. Ruck (33) 1636 posts |
I’m thinking along the lines that there needs to be a system mimemap file as now, but also a user mimemap file for the users own customised settings. That way the system mimemap can be replaced in its entirety by Boot Merge, and not affect the user settings which would have priority, |
Alan Robertson (52) 420 posts |
That’s a really good idea. |