The Graham Utilities for OS/2 - Version 2


[Warpspeed]

[Table of Contents] [Index] [Previous] [Next]


MIEncode - Encode MIME files

Summary

MIEncode encodes binary files into MIME files.

Icon

Command Line Format

Usage: MIEncode {Switches} <File>

Switches

-c
Console output.
-e
encode Extended Attribute data.
-s
include SUM information in the file.
-t
include TABLE information in the file.
-u
UNIX compatible file.

Description

MIME Encoding is a scheme which converts 8 bit data such as programs, to a 6 bit format for transmission through 6, 7 or 8 bit (typically electronic mail) networks. Such 6 or 7 bit networks are commonly found in mainframe or UNIX operating system environments.

MIME encoding and MIME decoding of files requires two utilities. MIEncode converts 8 bit data to a 6 bit format. The companion utility, MIDecode, restores the 6 bit data to the original 8 bit image.

A third utility, SUM, may be used to verify that a file has been received and correctly converted.

Encoding Method

MIENCODE breaks a group of three 8 bit characters (24 bits) into four 6 bit characters which are used as an index into the character set table shown below.

The characters are:

ABCDEFGHIJKLMNOP
QRSTUVWXYZabcdef
ghijklmnopqrstuv
wxyz0123456789+/
These characters have been especially selected for their ability to remain unchanged when passed through various EMail systems and the character conversions that invariably accompanies them.

Note : This translation scheme results in a file expansion of approximately 33%.

The extension of the MIME file is .MIM.

MIENCODE also places some information about the original file in the header of the MIME file. The original file name, size, time and date are placed in the header. This is done to provide a little more information to enable the encode/decode process to be checked.

-c Console output

By default, the output of MIEncode is FILE.MIM. This switch forces MIEncode to send its output to the console so that it may be redirected or piped into another program.

-e encode Extended Attribute data

The default operation of MIEncode, like every other encoder/decoder pair available, is to ignore the Extended Attribute data associated with files. This switch forces MIEncode to encode any available Extended Attribute data attached to the file and include it in the encoded data stream. The encoding works in the same manner as the actual file data is encoded, but Extended Attribute data is encoded separately at the end of the file and is delimited using an "eaname" keyword as opposed to "name".

-s include SUM information in the file

This switch forces MIENCODE to include SUM information in the top of the MIME file. This is to help the verification process to ensure that the decoded file has been successfully transmitted and decoded. This switch causes MIENCODE to read the file which is to be encoded twice - so it will take slightly longer. The SUM information is identical to the information produced by the SUM utility.

-t include TABLE information in the file

This switch forces MIENCODE to include TABLE information in the top of the MIME file. This is to help the verification process to ensure that the decoded file has been successfully transmitted and decoded. The TABLE information is the actual encoding table which was used to encode the data. If any characters are changed as they travel through various EMail systems, then the same characters in the TABLE should also be changed. Thus the file should still be able to be decoded at the other end. The actual MIME standard does not support this. But if you are having troubles decoding a file, the switch may help determine if the character set has been corrupted or not.

-u UNIX compatible file

Both OS/2 and DOS systems use a carriage return and line feed character pair (CR/LF) to represent an end of line. Under UNIX the standard is to use a single line feed (LF) to represent the end of line. By default MIENCODE produces files which use the CR/LF pair for the end of line. This switch forces MIENCODE to use a single LF character for an end of line.

Examples

MIENCODE CHARSET.DAT
This will produce a MIME encoded file CHARSET.MIM. It will be a normal OS/2 text file and spaces will be used.
MIENCODE CHARSET.DAT /u
MIENCODE will produce a UNIX compatible text file called CHARSET.MIM.
MIENCODE CHARSET.DAT -stu
MIENCODE will produce a UNIX compatible file with quotes. Full checksum information will be included in the MIME file. The encoding table will also be included in the file. Use these options if CHARSET.MIME is likely to go to a UNIX system via an unknown route. The checksum information will help the user validate that the file has been transmitted, received and decoded successfully.
MIENCODE CHARSET.DAT -c
The encoded data stream will be output to the console.
MIENCODE CHARSET.DAT -c | Clipbrd
The file CHARSET.DAT will be MIME Encoded and the output will be piped into the Clipbrd program which places the data in the clip board.
MIENCODE CHARSET.DAT -ce
The file CHARSET.DAT will be MIME Encoded to the console and any Extended Attribute data attached to the file will also be encoded.