1uuencode(1C)                Communication Commands                uuencode(1C)
2
3
4

NAME

6       uuencode, uudecode - encode a binary file, or decode its encoded repre‐
7       sentation
8

SYNOPSIS

10       uuencode [source-file] decode_pathname
11
12
13       uuencode [-m] [source-file] decode_pathname
14
15
16       uudecode [-p] [encoded-file]
17
18
19       uudecode [-o outfile] [encoded-file]
20
21

DESCRIPTION

23       These commands encode and decode files as follows:
24
25   uuencode
26       The uuencode utility converts a binary file into an encoded representa‐
27       tion that can be sent using mail(1). It encodes the contents of source-
28       file, or the standard input if no source-file argument  is  given.  The
29       decode_pathname  argument is required. The  decode_pathname is included
30       in the encoded file's header as the name of the file into  which  uude‐
31       code  is to place the binary (decoded) data. uuencode also includes the
32       permission modes of source-file (except  setuid,  setgid,  and  sticky-
33       bits),  so that decode_pathname is recreated with those same permission
34       modes.
35
36   uudecode
37       The uudecode utility reads an encoded-file, strips off any leading  and
38       trailing  lines  added  by  mailer programs, and recreates the original
39       binary data with the filename and the mode specified in the header.
40
41
42       The encoded file is an ordinary portable character set  text  file;  it
43       can be edited by any text editor. It is best only to change the mode or
44       decode_pathname in the header to avoid corrupting the decoded binary.
45

OPTIONS

47       The following options are supported:
48
49   uuencode
50       -m    Encodes source-file using Base64 encoding and sends it  to  stan‐
51             dard output.
52
53
54   uudecode
55       -o outfile    Specifies  a file pathname that should be used instead of
56                     any pathname contained in the input data.  Specifying  an
57                     outfile option-argument of /dev/stdout indicates standard
58                     output.This allows uudecode to be used in a pipeline.
59
60
61       -p            Decodes encoded-file and sends  it  to  standard  output.
62                     This allows uudecode to be used in a pipeline.
63
64

OPERANDS

66       The following operands are supported by uuencode and uudecode:
67
68   uuencode
69       decode_pathname    The  pathname  of  the  file into which the uudecode
70                          utility will place the decoded file.  If  there  are
71                          characters  in  decode_pathname  that are not in the
72                          portable filename character  set,  the  results  are
73                          unspecified.
74
75
76       source-file        A pathname of the file to be encoded.
77
78
79   uudecode
80       encoded-file    The  pathname  of a file containing the output of uuen‐
81                       code.
82
83

USAGE

85       See largefile(5) for the description of the behavior  of  uuencode  and
86       uudecode  when  encountering  files  greater than or equal to 2 Gbyte (
87       2^31 bytes).
88

ENVIRONMENT VARIABLES

90       See environ(5) for descriptions of the following environment  variables
91       that  affect  the  execution  of  uuencode  and uudecode: LANG, LC_ALL,
92       LC_CTYPE, LC_MESSAGES, and NLSPATH.
93

OUTPUT

95       stdout
96
97   uuencode Base64 Algorithm
98       The standard output is a text file, encoded in the character set of the
99       current locale, that begins with the line:
100
101         begin-base64 %s %s0 mode, decode_pathname
102
103
104
105
106       and ends with the line:
107
108         ====
109
110
111
112
113       In  both  cases,  the lines have no preceding or trailing blank charac‐
114       ters.
115
116
117       The encoding process represents 24-bit groups of input bits  as  output
118       strings  of   four encoded characters. Proceeding from left to right, a
119       24-bit input group is formed by concatenating three 8-bit input groups.
120       Each  24-bit  input  group   is then treated as four concatenated 6-bit
121       groups, each of which is translated into a single digit in  the  Base64
122       alphabet.  When  encoding a bit stream by means of the Base64 encoding,
123       the bit stream is presumed to be ordered with the most-significant  bit
124       first.  That  is,  the first bit in the stream is the high-order bit in
125       the first byte, and the eighth bit is the low-order bit  in  the  first
126       byte,  and so on. Each 6-bit group is used as an index into an array of
127       64 printable characters, as shown in the following table.
128
129         Value Encoding   Value Encoding   Value Encoding   Value Encoding
130           0      A         17     R         34     i         51     z
131           1      B         18     S         35     j         52     0
132           2      C         19     T         36     k         53     1
133           3      D         20     U         37     l         54     2
134           4      E         21     V         38     m         55     3
135           5      F         22     W         39     n         56     4
136           6      G         23     X         40     o         57     5
137           7      H         24     Y         41     p         58     6
138           8      I         25     Z         42     q         59     7
139           9      J         26     a         43     r         60     8
140          10      K         27     b         44     s         61     9
141          11      L         28     c         45     t         62     +
142          12      M         29     d         46     u         63     /
143          13      N         30     e         47     v
144          14      O         31     f         48     w        (pad)   =
145          15      P         32     g         49     x
146          16      Q         33     h         50     y
147
148
149
150
151       The character referenced by the index is placed in the output string.
152
153
154       The output stream (encoded bytes) is represented in lines  of  no  more
155       than  76 characters each. All line breaks or other characters not found
156       in the table are ignored by decoding software (see uudecode).
157
158
159       Special processing is performed if fewer than 24 bits are available  at
160       the end of a message or encapsulated part of a message. A full encoding
161       quantum is always completed at the end of a message. When fewer than 24
162       input  bits are available in an input group, zero bits are added on the
163       right to form an integral number  of  6-bit  groups.  Output  character
164       positions  that are not required to represent actual input data are set
165       to the equals (=) character. Since all Base64 input is an integral num‐
166       ber of octets, only the following cases can arise:
167
168           1.     The  final quantum of encoding input is an integral multiple
169                  of 24 bits. Here, the final unit of  encoded  output  is  an
170                  integral multiple of four characters with no '= ' padding.
171
172           2.     The  final  quantum  of  encoding  input is exactly 16 bits.
173                  Here, the final unit of encoded output is  three  characters
174                  followed by one '=' padding character.
175
176           3.     The final quantum of encoding input is exactly 8 bits. Here,
177                  the final unit of encoded output is two characters  followed
178                  by two '=' padding characters.
179
180
181       A  terminating  "===="  evaluates to nothing and denotes the end of the
182       encoded data.
183
184   uuencode Historical Algorithm
185       The standard output is a text file (encoded in the character set of the
186       current locale) that begins with the line:
187
188         begin %s %s\n, mode, decode_pathname
189
190
191
192
193       and ends with the line:
194
195         end\n
196
197
198
199
200       In  both  cases,  the lines have no preceding or trailing blank charac‐
201       ters.
202
203
204       The algorithm that is used for lines between begin and end takes  three
205       octets  as  input and writes four characters of output by splitting the
206       input at six-bit intervals into four octets,  containing  data  in  the
207       lower six bits only. These octets are converted to characters by adding
208       a value of 0x20 to each octet, so that  each  octet  is  in  the  range
209       0x20−0x5f,  and  each octet is assumed to represent a printable charac‐
210       ter. Each octect is then translated into  the  corresponding  character
211       codes  for  the  codeset in use in the current locale. For example, the
212       octet 0x41, representing 'A', would be translated to 'A' in the current
213       codeset, such as 0xc1 if the codeset were EBCDIC.
214
215
216       Where  the  bits of two octets are combined, the least significant bits
217       of the first octet are shifted left and combined with the most signifi‐
218       cant  bits of the second octet shifted right. Thus, the three octets A,
219       B, C are converted into the four octets:
220
221         0x20 + (( A >> 2                          ) & 0x3F)
222         0x20 + (((A << 4)  ((B >> 4) & 0xF)) & 0x3F)
223         0x20 + (((B << 2)  ((C >> 6) & 0x3)) & 0x3F)
224         0x20 + (( C                                 ) & 0x3F)
225
226
227
228
229       These octets are then translated into the local character set.
230
231
232       Each encoded line contains a length character, equal to the  number  of
233       characters  to  be  decoded plus 0x20 translated to the local character
234       set as described above, followed by the encoded characters. The maximum
235       number of octets to be encoded on each line is 45.
236

EXIT STATUS

238       The following exit values are returned:
239
240       0     Successful completion.
241
242
243       >0    An error occurred.
244
245

ATTRIBUTES

247       See attributes(5) for descriptions of the following attributes:
248
249
250
251
252       ┌─────────────────────────────┬─────────────────────────────┐
253       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
254       ├─────────────────────────────┼─────────────────────────────┤
255       │Availability                 │SUNWesu                      │
256       ├─────────────────────────────┼─────────────────────────────┤
257       │Interface Stability          │Standard                     │
258       └─────────────────────────────┴─────────────────────────────┘
259

SEE ALSO

261       mail(1), mailx(1), uucp(1C), uux(1C), attributes(5), environ(5), large‐
262       file(5), standards(5)
263

NOTES

265       The size of the encoded file is expanded by 35% (3 bytes become 4, plus
266       control  information),  causing  it to take longer to transmit than the
267       equivalent binary.
268
269
270       The user on the remote system who is invoking uudecode (typically uucp)
271       must  have  write  permission on the file specified in the decode_path‐
272       name.
273
274
275       If you invoke uuencode and then execute uudecode on a file in the  same
276       directory, you will overwrite the original file.
277
278
279
280SunOS 5.11                        6 Aug 2003                      uuencode(1C)
Impressum