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:
| 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 |
| 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 | ||||||||||||||||||||
| 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 | ||||||||||||||||||||
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||