Topic Path: Symbol Reference > Files > IdMessageCoderMIME.pas
ContentsIndexHome
PreviousUpNext
IdMessageCoderMIME.pas

Contains types, classes, procedures, functions, and constant variables used to implement coders and decoders for RFC 2822-compliant MIME message parts. Description IdMessageCoderMIME.pas contains types, classes, procedures, functions, and constant variables used to implement coders and decoders for RFC-2822 compliant MIME message parts. 

MIME encoding allows data to be represented in a 7-bit textual representation, called Base64, as described in the Internet Standards documents: 

RFC 2045 - Multipurpose Internet Mail Extensions (MIME), Part One: Format of Internet Message Bodies, Section 6.8 Base64 Content-Transfer-Encoding 

RFC 2046 - Multipurpose Internet Mail Extensions (MIME), Part Two: Media Types 

RFC 2047 - MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text  

The MIME, or Base64, encoding mechanism is designed to represent arbitrary sequences of byte data in a form that need not be humanly readable. Base64 encoding is almost identical to the mechanism used in Privacy Enhanced Mail (PEM) applications, as defined in: 

RFC 1421 - Privacy Enhancement for Internet Electronic Mail, Part I: Message Encryption and Authentication Procedures  

Base64 encoding uses a 64-character subset of US-ASCII, enabling 6 bits to be represented per printable character. An extra character ("=") has special significance in Base64 encoding. Base64 encoding can represent all version of ISO 646, including US-ASCII, and all characters in the subset are also represented identically in EBCDIC. 

Base64 encoding represents 24-bit groups of input as output strings of 4 encoded characters. Proceeding from left to right, a 24-bit input group is formed by concatenating 3 8-bit input groups. These 24 bits are then treated as 4 concatenated 6-bit groups, each of which is translated into a single digit in the base64 alphabet. 

Each 6-bit group is used as an index into an array of 64 printable characters. The character referenced by the index is placed in the output string. These characters are selected to be universally representable, and the set excludes characters with particular significance to SMTP (".", CR, LF) and to the multipart boundary delimiters ("-") defined in: 

RFC 2046 - Multipurpose Internet Mail Extensions (MIME),  

Part Two: Media Types  

The following table identifies characters and encodings for the Base64 Alphabet: 

 

Value 
Encoding 
Value 
Encoding 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
10 
44 
11 
45 
12 
46 
13 
47 
14 
48 
15 
49 
16 
50 
17 
51 
18 
52 
19 
53 
20 
54 
21 
55 
22 
56 
23 
57 
24 
58 
25 
59 
26 
60 
27 
61 
28 
62 
29 
63 
30 
(pad) 
31 
 
 
32 
 
 
33 
 
 

 

Base64-encoded output must be represented in lines of no more than 76 characters each. All line breaks or other characters not found in the Base64 alphabet must be ignored by decoding software. 

Special processing is performed if fewer than 24 bits are available at the end of the data being encoded. A full encoding quantum is always completed at the end of a body. When fewer than 24 input bits are available in an input group, zero bits are added (on the right) to form an integral number of 6-bit groups. Padding at the end of the data is performed using the "=" character. 

Because it is used only for padding at the end of the data, the occurrence of any "=" characters may be taken as evidence that the end of the data has been reached (without truncation in transit). No such assurance is possible, however, when the number of octets transmitted was a multiple of three and no "=" characters are present. 

Any characters outside of the Base64 alphabet are to be ignored when present in Base64-encoded data. 

Base64 encoding is commonly used in E-Mail and Usenet messages.

Class 
Description 
Represents a registered decoder class and detects the decoder boundary marker in a message part. 
Implements a decoder for RFC 2822-compliant MIME message parts. 
Represents the registered encoder class and updates properties for an associated message. 
Implements an encoder for RFC 2822-compliant MIME message parts. 
Implements a class for generating and storing MIME boundary markers. 
Constant 
Description 
Identifies characters which cannot be used in folder path names, shortcuts, or file names on the Windows platform. 
Represents the MIME content-transfer-encoding for US-ASCII data. 
 
Represents the MIME content-type family for textual data. 
Variable 
Description 
MIME boundary strings used in Indy message encoder classes. 
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.