1UUENCODE(1P)               POSIX Programmer's Manual              UUENCODE(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       uuencode — encode a binary file
13

SYNOPSIS

15       uuencode [-m] [file] decode_pathname
16

DESCRIPTION

18       The uuencode utility shall write an encoded version of the named  input
19       file,  or  standard  input if no file is specified, to standard output.
20       The output shall be encoded using one of the  algorithms  described  in
21       the  STDOUT  section  and shall include the file access permission bits
22       (in chmod octal or  symbolic  notation)  of  the  input  file  and  the
23       decode_pathname,  for  re-creation  of  the file on another system that
24       conforms to this volume of POSIX.1‐2017.
25

OPTIONS

27       The uuencode utility shall conform to the Base  Definitions  volume  of
28       POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines.
29
30       The following option shall be supported by the implementation:
31
32       -m        Encode  the  output using the MIME Base64 algorithm described
33                 in STDOUT.  If -m is not specified, the historical  algorithm
34                 described in STDOUT shall be used.
35

OPERANDS

37       The following operands shall be supported:
38
39       decode_pathname
40                 The  pathname  of  the  file  into which the uudecode utility
41                 shall place the decoded file.  Specifying  a  decode_pathname
42                 operand of /dev/stdout shall indicate that uudecode is to use
43                 standard output. If there are characters  in  decode_pathname
44                 that  are  not  in  the  portable  filename character set the
45                 results are unspecified.
46
47       file      A pathname of the file to be encoded.
48

STDIN

50       See the INPUT FILES section.
51

INPUT FILES

53       Input files can be files of any type.
54

ENVIRONMENT VARIABLES

56       The following environment variables shall affect the execution of uuen‐
57       code:
58
59       LANG      Provide  a  default  value for the internationalization vari‐
60                 ables that are unset or null. (See the Base Definitions  vol‐
61                 ume  of POSIX.1‐2017, Section 8.2, Internationalization Vari‐
62                 ables for the precedence  of  internationalization  variables
63                 used to determine the values of locale categories.)
64
65       LC_ALL    If  set  to  a non-empty string value, override the values of
66                 all the other internationalization variables.
67
68       LC_CTYPE  Determine the locale for the interpretation of  sequences  of
69                 bytes of text data as characters (for example, single-byte as
70                 opposed to  multi-byte  characters  in  arguments  and  input
71                 files).
72
73       LC_MESSAGES
74                 Determine the locale that should be used to affect the format
75                 and contents  of  diagnostic  messages  written  to  standard
76                 error.
77
78       NLSPATH   Determine the location of message catalogs for the processing
79                 of LC_MESSAGES.
80

ASYNCHRONOUS EVENTS

82       Default.
83

STDOUT

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

STDERR

215       The standard error shall be used only for diagnostic messages.
216

OUTPUT FILES

218       None.
219

EXTENDED DESCRIPTION

221       None.
222

EXIT STATUS

224       The following exit values shall be returned:
225
226        0    Successful completion.
227
228       >0    An error occurred.
229

CONSEQUENCES OF ERRORS

231       Default.
232
233       The following sections are informative.
234

APPLICATION USAGE

236       The file is expanded by 35 percent (each three octets become four, plus
237       control information) causing it to take longer to transmit.
238
239       Since  this  utility  is  intended  to create files to be used for data
240       interchange between systems with possibly different  codesets,  and  to
241       represent binary data as a text file, the ISO/IEC 646:1991 standard was
242       chosen for a midpoint in the algorithm as a known reference point.  The
243       output  from uuencode is a text file on the local system. If the output
244       were in the ISO/IEC 646:1991 standard codeset, it might not be  a  text
245       file  (at  least because the <newline> characters might not match), and
246       the goal of creating a text file would be defeated. If this  text  file
247       was  then carried to another machine with the same codeset, it would be
248       perfectly compatible with that system's uudecode.  If it was  transmit‐
249       ted  over  a mail system or sent to a machine with a different codeset,
250       it is assumed that, as for every  other  text  file,  some  translation
251       mechanism  would convert it (by the time it reached a user on the other
252       system) into an appropriate codeset. This translation only makes  sense
253       from  the  local  codeset,  not  if  the  file  has  been  put  into  a
254       ISO/IEC 646:1991 standard representation first. Similarly,  files  pro‐
255       cessed by uuencode can be placed in pax archives, intermixed with other
256       text files in the same codeset.
257

EXAMPLES

259       None.
260

RATIONALE

262       A new algorithm was added at the request of the international community
263       to  parallel  work  in RFC 2045 (MIME). As with the historical uuencode
264       format, the Base64 Content-Transfer-Encoding is designed  to  represent
265       arbitrary sequences of octets in a form that is not humanly readable. A
266       65-character subset of the ISO/IEC 646:1991 standard is used,  enabling
267       6 bits to be represented per printable character. (The extra 65th char‐
268       acter, '=', is used to signify a special processing function.)
269
270       This subset has the important property that it is  represented  identi‐
271       cally  in  all  versions of the ISO/IEC 646:1991 standard, including US
272       ASCII, and all characters in the subset are  also  represented  identi‐
273       cally in all versions of EBCDIC. The historical uuencode algorithm does
274       not share this property, which is the reason that  a  second  algorithm
275       was added to the ISO POSIX‐2 standard.
276
277       The  string "====" was used for the termination instead of the end used
278       in the original format because the latter is a  string  that  could  be
279       valid encoded input.
280
281       In  an early draft, the -m option was named -b (for Base64), but it was
282       renamed to reflect its relationship to the  RFC 2045.  A  -u  was  also
283       present to invoke the default algorithm, but since this was not histor‐
284       ical practice, it was omitted as being unnecessary.
285
286       See the RATIONALE  section  in  uudecode  for  the  derivation  of  the
287       /dev/stdout symbol.
288

FUTURE DIRECTIONS

290       None.
291

SEE ALSO

293       chmod, mailx, uudecode
294
295       The  Base  Definitions  volume  of POSIX.1‐2017, Chapter 8, Environment
296       Variables, Section 12.2, Utility Syntax Guidelines
297
299       Portions of this text are reprinted and reproduced in  electronic  form
300       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
301       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
302       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
303       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
304       event of any discrepancy between this version and the original IEEE and
305       The Open Group Standard, the original IEEE and The Open Group  Standard
306       is  the  referee document. The original Standard can be obtained online
307       at http://www.opengroup.org/unix/online.html .
308
309       Any typographical or formatting errors that appear  in  this  page  are
310       most likely to have been introduced during the conversion of the source
311       files to man page format. To report such errors,  see  https://www.ker
312       nel.org/doc/man-pages/reporting_bugs.html .
313
314
315
316IEEE/The Open Group                  2017                         UUENCODE(1P)
Impressum