Uuencoding
Uuencoding refers to the use of the uuencode(1) and uudecode(1) utilities for transfer of binary files between Unix hosts.
Contents
Structure
A uuencoded file looks like:
begin 644 cat.txt #0V%T ` end
The begin line includes the file permissions and name.
Each line is a chunk of binary data represented by printable characters. Each character represents 6 bits of the original binary data. The chunks contain up to 45 bytes of original data or 60 bytes of encoded data. Each line is prefixed by a character representing the original size of that chunk. The most common prefixes are M, which represents a full chunk, and `, which represents an empty line.
The end line always follows one such empty line.
The above file is the result of uuencoding "Cat".
Code Points
Every 6 bits are encoded as a printable character by adding 32 to the binary value. The exception is a null value.
Binary Value |
Encoded Value |
ASCII Code Point |
00 |
96 |
` |
01 |
33 |
! |
02 |
34 |
" |
03 |
35 |
# |
04 |
36 |
$ |
05 |
37 |
% |
06 |
38 |
& |
07 |
39 |
' |
08 |
40 |
( |
09 |
41 |
) |
10 |
42 |
* |
11 |
43 |
+ |
12 |
44 |
, |
13 |
45 |
- |
14 |
46 |
. |
15 |
47 |
/ |
16 |
48 |
0 |
17 |
49 |
1 |
18 |
50 |
2 |
19 |
51 |
3 |
20 |
52 |
4 |
21 |
53 |
5 |
22 |
54 |
6 |
23 |
55 |
7 |
24 |
56 |
8 |
25 |
57 |
9 |
26 |
58 |
: |
27 |
59 |
; |
28 |
60 |
< |
29 |
61 |
= |
30 |
62 |
> |
31 |
63 |
? |
32 |
64 |
@ |
33 |
65 |
A |
34 |
66 |
B |
35 |
67 |
C |
36 |
68 |
D |
37 |
69 |
E |
38 |
70 |
F |
39 |
71 |
G |
40 |
72 |
H |
41 |
73 |
I |
42 |
74 |
J |
43 |
75 |
K |
44 |
76 |
L |
45 |
77 |
M |
46 |
78 |
N |
47 |
79 |
O |
48 |
80 |
P |
49 |
81 |
Q |
50 |
82 |
R |
51 |
83 |
S |
52 |
84 |
T |
53 |
85 |
U |
54 |
86 |
V |
55 |
87 |
W |
56 |
88 |
X |
57 |
89 |
Y |
58 |
90 |
Z |
59 |
91 |
[ |
60 |
92 |
\ |
61 |
93 |
] |
62 |
94 |
^ |
63 |
95 |
_ |
History
Uuencoding was developed in response to poor handling of different character encodings and character sets across message transfer agents. In particular, this addressed the need to send files between Unix systems.
The names and designs of the uuencode(1) and uudecode(1) utilities comes from the Unix-to-Unix Copy protocol (UUCP).