TITLE
    UUencode & UUdecode: Explained
Article ID:
Created:
Modified:
18758
10/17/95
5/31/00

TOPIC

    This article describes UUencoding and UUdecoding, a popular method to transfer binary information on the Internet.


DISCUSSION

    What is UUencode?
    UUencode stands for Unix-to-Unix Encode. It is a text-based binary encryption protocol in wide use on the Internet to transfer files across multiple platforms including UNIX, Windows, MS-DOS, Macintosh, and other operating systems. UUencode is the UNIX name for the encryption program; it is normally used with another UNIX program, UUdecode, which decodes an encrypted message.

    Why UUencode files?
    The basic idea behind UUencoding a file is to translate a binary representation of data -- which could be a graphic image, compressed file, or other type of binary data -- into an encrypted text representation of that file.

    There are two reasons for doing this:

    1) Many mail systems used on the Internet cannot handle binary transmissions since they are designed for text data. However, if a file is UUencoded, it can be included as text in the message.

    2) Many mail systems and gateways have size limitations, often less than 50 kilobytes (K). It is sometimes necessary to use a text editor to split or combine such files. Since a binary representation of that data would make the editing of data very difficult, and since software that automatically joins these binary files is relatively rare, UUencoding a binary file allows common text editors to be used to join such files.

    How can you tell it's a UUencoded file?
    There is no standard file name convention, although most UNIX-based systems use a .uu as a suffix. DOS-based computers, with their standard three-digit suffixes, generally use .uue. This is one general method of telling whether or not it is a UUencoded file. Another method is actually looking at the first line of the file.

    A UUencoded file can be identified by the first line of the file:

    -> begin 644 myfile.gif

    This line is followed immediately by the start of the data. The first character of every line is the letter M. If the file has other characters other than M, the file is either not a UUencoded file, or has been damaged:

    -> MuVAA=baI<RabzvYHyw@_cpUbzvYHyw@@zwl@xF]TzbaAhgmE=baOyBaA<gaL

    The block ends with a single line containing the statement:

    -> end

    The first line signals the start of the block. The number 644 is a UNIX permissions flag (in this case, giving the owner of the file full read and write permissions) while giving other users read permissions only). The third part is the file name that uudecode will expand the file as.

    What are the versions of UUencode?
    UUencode is a standard, but a number of implementations of the software exist. Most implementations are based upon source code from versions of the UNIX software which are in the public domain.

    Macintosh and most Windows versions tend to combine both the UUencode and UUdecode functions into a single program, and simply allow you to choose if you want to encode or decode a message.

    What issues should I be aware of?
    UUencoded data should be line-terminated with a single carriage return. Some mail systems append multiple line feeds or carriage returns, which can confuse some implementations of UUdecode.

    UUencode is intended for use with a straight binary file. Since Macintosh files contain both a data fork and a resource fork, you should use Binhex to send Macintosh binary files. There are some types of files that you can UUencode, but you should limit these to files you know are going to other people using different operating systems.

    Types of Files You Can UUencode
    • Graphics (includes GIF, JPEG, and TIFF files)*
    • Word processing files
    • Miscellaneous non-Macintosh specific files

    * PICT files are Macintosh based, so you should use Binhex to transmit these types of graphics.

    Type of Files You Should Not UUencode
    • Applications
    • Control panels
    • Extensions
    • Fonts
    • Macintosh-specific compressed files (SuffIt, Compacter)

    Note: You should use Binhex to transmit these types of files.


    UUencode and UUdecode Tips
    • Do not imbed "white space" in the file. The first line of the file should start with the begin line and the last line of the file should be the end statement.
    • If you UUencode a file, the only to determine if your file starts with begin and finishes with end is to open it in a text editor or word processing application and check it.
    • If a message was received as multiple email messages, intervening message headers and "white space" should be removed. Some UUdecode utilities cannot handle the additional returns and headers.
    • Since there are a large number of UUencoding and UUdecoding applications on various computer platforms, you may get some errors during the decoding process.
    • If you encounter errors decoding a file and are sure the source (input) file is correct, try a different UUdecoding utility. If the errors persist, have the sender of the data encrypt the data using a different version of UUencode.


Document Information
Product Area: Apple Software; Communications-Networking
Category: Internet Connection
Sub Category: General Topics
Keywords: kinter

Copyright © 2000 Apple Computer, Inc. All rights reserved.