Other Free Encyclopedias » Online Encyclopedia » Encyclopedia - Featured Articles » Contributed Topics from K-O

Mime Types

data sent binary bytes

Definition: Mime (Multi-purpose Internet Mail Extensions) is a simple standard prefix that is sent before a file is sent on the World Wide Web or as an e-mail attachment.

Essentially, a MIME type is a string consisting of two words: the first denotes the general type of the file that is about to be sent, the second denotes its format . A MIME type is specified in a single line, in the format:

<mime_type> ::= <type>/<format>
<type> ::= text I image | video | application |
<format> ::= <string>

The number of general types is, more or less, fixed, if not by a mutually agreed standard, at least by a sort of a gentlemen’s agreement deriving from practice. Whenever a web server sends a web (in html format) to a web browser, for instance, what is actually sent on the internet is the text:



Here the fragment text/html: is the MIME type of the data, and is followed by the data themselves, that is, by the html code. A JPEG image would be sent as:

image /jpeg:
[image data]

Note that, in general, the MIME specification is not interested about the nature of the data to be sent: the interpretation of the data is left to the client: the type simply serves the purpose of telling the client what the nature and the format of the data are. In the case of images, there is an additional complication, since the data are binary, and recent internet protocols (unlike older and more efficient ones such as ftp), do not allow sending binary files as they are, since many of the bytes with a value less than 32 (corresponding to the ASCII control codes ) are interpreted and, possibly, transformed. To make an example, Unix systems use the character 0D (hexadecimal), the ASCII carriage return to mark the end of a line, while Windows system, inheriting from DOS, use the pair 0A 0D ( line feed and carriage return ) for the same purpose. Many Windows programs, upon observing a 0D in input convert it in a pair 0D 0A. Clearly, if the character 0D was part of a binary file, this will result in an incorrect interpretation of the file. To ovviate to this problem, binary mime types are in general encoded so that only “printable” ASCII characters, that is, only bytes with a code between 32 and 128, are used. In this way, a binary file can be sent as if it were a text message. This is done through a method originally devised for unix systems and generally called, after the program that originally did the encoding, uuencode. The idea is to take a group of 3 binary bytes, divide them into four groups of six bytes each, and add a binary “01” in front of each one of them in order to obtain a printable ASCII character. Consider, for instance, the following encoding:

so, the three bytes are transformed into the string “AtrS”, which can be transmitted as a text message. The disadvantage if this encoding is evident: three bytes are encoded using four characters, so the length of the data file to be transmitted is increased by about 35?.

Minault, Gail (1939–) - History of South Asia [next] [back] Milstein, César

User Comments

Your email address will be altered so spam harvesting bots can't read it easily.
Hide my email completely instead?

Cancel or