Attach files with pure ascii

It’s always been a pain to have to attach programs or archives to our text-based posts, usually we just include an external link. A great solution to this is to just attach the file in code that uses only ascii! Yes, it’s known as uuencoding, a long time solution to convert binary to text so that files could be transferred as ascii encoding. These two programs originated on the Unix systems as uuencode and uudecode. uuencode takes the file and encodes it while uudecode un-encodes it and restores the file to it’s original state.

The format of the uuencoded format starts with this:

begin  

and ends with:

'
end

Where is the file’s Unix read/write/execute permissions as three octal digits, and is the name to be used when recreating the binary data.
The ascii data that goes in between this are groups of 4 characters on each line that encode every 3 characters of the file. An exception to this is the first character of each line, which is the value to represent the number of encoded characters on each line.

Here’s a great example from wikipedia:

begin 644 cat.txt
#0V%T
`
end

The above was cat.txt which contains the unencoded data: “cat”
Here’s how the encoding works:

And here’s a chart showing the characters for the start of each line and the 6-bit string they represent:

Anyways, if you use this to encode archives and you paste them in a file, try opening them with winrar. Winrar automatically decodes and opens them like a charm!
Otherwise, use uuencode and redirect it’s output to a file to encode it. And to rebuild a file from uuencode just run uudecode with the file argument and redirect output to the specified file to create it.
Download uuencode and uudecode: http://www.fpx.de/fp/Software/UUDeview
More information on uuencode: http://en.wikipedia.org/wiki/Uuencoding

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: