Multipurpose Internet Mail Extensions

[CJK]  [Home]
 

This page only lets you imagine what MIME is.  Read RFC 2045 through 2049 for first-hand information.


What is it?

MIME is the most popular method used by e-mail clients to re-encode anything in a mail-safe 7-bit format.  It has two encoding forms:


Quoted Printable

These characters can be directly encoded:

     ABCDEFGHIJKLMNOPQRSTUVWXYZ
     abcdefghijklmnopqrstuvwxyz
     0123456789
     '()+,-./:?

Any byte may be represented by an equal sign followed by the byte's hexadecimal value (e.g. an equal sign may be represented as "=3D") but a line break should remain a line break.

Encoded lines should contain no more than 76 characters.  An equal sign at the end of an encoded line indicates line continuation.

Contents Up

Base64

Turn any sequence of three bytes into a four-byte sequence using the following Base64 alphabet:

     ABCDEFGHIJKLMNOPQRSTUVWXYZ
     abcdefghijklmnopqrstuvwxyz
     0123456789+/

Say you want to encode "ABC", represented in binary form as

     01000001 01000010 01000011

Turn the three bytes into four 6-bit segments

     010000 010100 001001 000011

and spell them out as QUJD using the following table:

     000000 -> A     001101 -> N     011010 -> a     100111 -> n     110100 -> 0
     000001 -> B     001110 -> O     011011 -> b     101000 -> o     110101 -> 1
     000010 -> C     001111 -> P     011100 -> c     101001 -> p     110110 -> 2
     000011 -> D     010000 -> Q     011101 -> d     101010 -> q     110111 -> 3
     000100 -> E     010001 -> R     011110 -> e     101011 -> r     111000 -> 4
     000101 -> F     010010 -> S     011111 -> f     101100 -> s     111001 -> 5
     000110 -> G     010011 -> T     100000 -> g     101101 -> t     111010 -> 6
     000111 -> H     010100 -> U     100001 -> h     101110 -> u     111011 -> 7
     001000 -> I     010101 -> V     100010 -> i     101111 -> v     111100 -> 8
     001001 -> J     010110 -> W     100011 -> j     110000 -> w     111101 -> 9
     001010 -> K     010111 -> X     100100 -> k     110001 -> x     111110 -> +
     001011 -> L     011000 -> Y     100101 -> l     110010 -> y     111111 -> /
     001100 -> M     011001 -> Z     100110 -> m     110011 -> z

If there is only 1 byte at the end, add 4 zero bits, spell out the 12 bits and signal the 4 extra bits with two equal signs (==).  If there are 2 bytes left, add 2 zero bits, spell out the 18 bits and signal the 2 extra bits with one equal sign (=).

Contents Up

Header Fields

This is how you transmit an UTF-8 encoded smiley in the subject field using the Base64 alphabet:

=?utf-8?B?4pi6?=
Contents Up

Source

Contents Up

Gyula Zsigri [CJK]  [Home] June 11, 2002