Framework EDI Reference. Encoding Mechanism
UUEncode

UUEncode is an encoding mechanism that converts 8-bit binary characters to ASCII printable characters.  The encoding mechanism is similar to the Base64 mechanism, only without the translation table.  UUEncode determines the encoding character by adding 32 to the encoded decimal value, so that the resulting value falls into the printable characters section of the ASCII table.

The procedure for encoding is as follows:

  1. The data is subdivided into 3-byte groups forming a 24-bit stream.

    Example .  The 3-byte word "The" has the following 24-bit stream (yellow).

    Text T h e
    Byte Hex 0x54 0x68 0x65
    Bit Stream 0 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1

  2. The 24-bit stream is further subdivided into 6 bits.

    Example .  The 24-bit stream for the word "The" is subdivided as follows:

    Text T h e
    Byte Hex 0x54 0x68 0x65
    Bit Stream 0 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1
    6-Bit Group 0 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1
    6-Bit Value 21 6 33 37

  3. The value 32 is added to the decimal value of each of the 6-bit stream.  The result is the character represented in the ASCII table with corresponding decimal value.

    Example .  The 6-bit values are added with 32:

    Text T h e
    Byte Hex 0x54 0x68 0x65
    Bit Stream 0 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1
    6-Bit Group 0 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1
    6-Bit Value 21 + 32 = 53 6 + 32 = 38 33 + 32 = 65 37 + 32 = 69
    Encoding 5 & A E

    The resulting encoding for the word "The" is "5&AE".

Example

The following shows the UUEncode encoding transformation of the string "The car".  The encoded result is "5&AE(&-A<@".  The actual encoded byte stream is shown in the last row.

Text T h e SP c a r NULL
Byte Hex 0x54 0x68 0x65 0x20 0x63 0x61 0x72 0x00
Bit Stream 0 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 1 0 1 1 0 0 0 0 1 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0
6-Bit Group 0 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 1 0 1 1 0 0 0 0 1 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0
6-Bit Value 21 6 33 37 8 6 13 33 28 32 0
+32 53 38 65 69 40 38 45 65 60 64
Encoding 5 & A E ( & - A < @
Byte Stream 0x2B 0x26 0x41 0x45 0x28 0x26 0x2D 0x41 0x3C 0x40