# OPL and MIME

## Contents

- MIME priorities
- MIME content types

- References

OPL applications can support files with a recognised MIME content type though the `MIME` OPL keyword. This is in addition to their recognising their own kinds of document through the use of UIDs.

EPOC Release 5 supports MIME recognition for foreign documents. These are files which are not native to EPOC, and have no UIDs, such as plain text files. Under ER5, they can be identified by the system and handled by an appropriate program.

The foreign file is mapped to a MIME type by a MIME recogniser located in `\System\Recogs\`. When the file is started from the System screen, an appropriate application is started to handle the file based on its recognised MIME content type.

The `MIME` keyword is used as in the following example:

        APP myEditor, KUidMyEditorApp&
              FLAGS KFlagsAppFileBased%
              CAPTION "myEditor", KLangEnglish%
              MIME KDataTypePriorityNormal%, "text/plain"
        ENDA

## MIME priorities

Each OPL application which can handle files of a particular MIME type has an associated priority as described in the reference for the `MIME` keyword. EPOC uses the priority of an application to decide whether it should be used for opening a file in preference to other applications which can handle files of the same MIME type. The application with the highest priority is used to open the file.

## MIME content types

Files which are recognised by an EPOC system recogniser are associated with a particular MIME type. The MIME type of a file is a string which describes the content of that file; you can examine the MIME type of files on an EPOC device by selecting the file from the System screen and selecting `File | Properties...` from the menu. If the `File type` has a forward slash in it, e.g. `text/plain` or `image/png`, then that file is being recognised by a MIME recogniser.

The recogniser makes the association between a file and its type by a combination of factors, one of which is the file’s extension. If the file extension is changed, then a different association might be made, and a different application may be used to handle the file.

### References

It is beyond the scope of this document to describe MIME content types and mechanisms in detail, but the possibilities are described fully in the following RFCs:

- RFC 2045: Multipurpose Internet Mail Extensions (MIME) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies.
- RFC 2046: Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types.
- RFC 2047: Multipurpose Internet Mail Extensions (MIME) Part Three: Message Header Extensions for Non-ASCII Text.
- RFC 2048: Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures.
- RFC 2049: Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples.

RFCs are a standard resource for programmers, and may be downloaded from and read at many Internet sites including:

- http://www.rfc-editor.org/ [USA]
- http://www.it.kth.se/docs/rfc/ [Sweden]
- http://www.csl.sony.co.jp/rfc/ [Japan]
- http://src.doc.ic.ac.uk/rfc/ [United Kingdom]