No Next Item No Next Conference Can't Favor Can't Forget Item List Conference Home Entrance    Help
View Responses


Grex Info Item 307: uudecode/uuencode and mime problems and general theory
Entered by keesan on Thu Jun 4 00:58:31 UTC 1998:

I am transferring a discussion started in Agora concerning uuencode
and uudecode, and mime, which code/decode binary files so they can
be sent via e-mail.

1 responses total.



#1 of 1 by keesan on Thu Jun 4 01:04:55 1998:

#187 C. Keesan(keesan) on Wed May 27 14:35:34 1998:
I am still hoping a helper will explain to me how to decode binary files that
 were sent to me as attachments.  It seems I have to know
 whether unix decodes mime or uuencode so they know what to send me, as well
 as how to decode the file after saving the attachment.  HELP!  I will soon
 have a large binary file coming my way that I won't be able to read.)

#188 Rane Curl(rcurl) on Wed May 27 16:13:15 1998:

 You donwnload the binary file and open it in the application for which
 it was written. Saving the file in your directory decodes the MIME. 
 You have do uudecode, or whatever is required. Usually people just send
 me documents in the original binary form (MS_WORD, e.g.) and once I
 save them and download them, they open fine. 

#189 C. Keesan(keesan) on Wed May 27 16:37:24 1998:
 Obviously this document was not sent to me in MIME, I will ask them to resend
 it in MIME.  I assume PINE automatically codes things in MIME.
 
 How do I decode uuencode, in case I ever need to?  Typing uudecode followed
 by the filename did not work.

#190 C. Keesan(keesan) on Wed May 27 17:00:41 1998:
 I downloaded the file which I think was sent to me MIMEd, and when I read it
 in WP, instead of gibberish consisting of lower-level ASCII characters (7-bit)
 this time I also got the upper level characters (8-bit).  I suggested that
 they resend the file in binary form without encoding it, but they have
 probably gone home for the day by now.

#191 C. Keesan(keesan) on Wed May 27 18:34:53 1998:
 I received another MIME copy of a file, which they suggested might work better
 since they were sending just one attachment instead of three at a time.
 Time to download it and try again to read it.

#192 C. Keesan(keesan) on Wed May 27 18:39:48 1998:
 The single attachment gave the same upper-ASCII file as the three attachments
 did (when I saved them individually).  MIME files give upper ASCII, uuencode
 lower ASCII only.  Saving to my home directory (V for View, S for Save) does
 not seem to automatically decode files.  Am I autmoatically encoding when I
 send binary files with PINE as attachments?  I asked them again to send an
 uncoded binary file.

#195 Rane Curl(rcurl) on Wed May 27 22:40:03 1998:
 The MIME encoding and decoding is automatic in pine. Did you specify a
 *binary* download? Do you have the same application (and same or newer
 version) that wrote the file they sent? 
 
 This can be a very frustrating exercise. I am trying to help someone send
 a file to me so that I can open it, but they haven't yet told me what the
 application and communications programs are. They may be using a different
 protocol for the attachment, or encoding it in some fashion they haven't
 told you, etc. You have to know *exactly* what they did before you can
 solve these file transfer problems (except by hit or miss or by good
 luck).
 
#197 C. Keesan(keesan) on Fri May 29 10:54:19 1998:
 Re 195, they never even exactly told me what coding program they used the
 first time.  The second time they told me that they could also send it in Mime
 format or hex something or other as well as uuencode (which led me to believe
 they used uuencode the first time and mime the second).  I typed set file
 type binary when using Kermit to download.  What looks like all letters in
 grex looks like upper ASCII in WP5.1.  I sent them WP5.1, it got edited at
 their end, they did not tell me if it remained in WP5.1, though I asked
 twice about this.  I will write again and ask for specific answers.  I would
 hope the communications programs do not have to match.  I doubt that the
 person who sent me the files knows what was done to them first.  We will 
 experiment by sending a WP5.1 binary file from one of us to the other.

#199 Rane Curl(rcurl) on Fri May 29 11:45:44 1998:
 If the file you received is all letters, it is MIME or uuencode or binhex
 (others?). Pine decodes MIME automatically (it is "MIME compliant" - the
 free e-mail service "juno" is not, by the way - you can't send someone on
 juno an attachment from pine and have it decoded for them). You can tell
 if it is uuencoded by the first lines of the file, which reads like "begin
 644 newname". 
 
 You uuencode a file with the command
 
 uuencode newname <file> uuname.uu
 
 newname is the name the file will have when it is decoded, file is the
 file to be encoded (the brackets must be written in the command),
 uuname.uu is the name to give the uuencoded file (it is convention to add
 the .uu to identify the file type). 
 
 You decode it with
 
 uudecode uuname.uu
 
 and the file newname will be created with the contents of the original
 file.
 
 (The instructions in man uuencode are not correct.)

#200 C. Keesan(keesan) on Fri May 29 12:02:06 1998:
 I just printed out your instructions and will try them on the first three
 files that were sent to me.  Thanks.  I always assume it is me rather than
 the instructions which have the problem.  

#201 C. Keesan(keesan) on Fri May 29 12:13:04 1998:
 Rane, I am afraid I did not understand your instructions.  The file sent to
 me, and saved from my e-mail attachment to my home directory, is called (by
 the sender, and I did not change the name) Ge9495a.cec.
 I tried uudecode Ge9495a.cec and got 'No 'end' line.
 I tried uudecode Ge9495a.uu,  Ge9495a.cec.uu, and uuGe9495a.cec and got
 no such file or directory.  Do I need more info from the sender, or am 
 I just completely off track in following your instructions?
 Hopefully this file is accessible to you as well, do you want to give it
 a try decoding it?  Or let me know what to do to make it accessible?
 I also saved what I am hoping are mimed files, one of which is mimea (the same
 file), and it did not automatically decode (I checked in WP5.1).

#202 Mike McNally(mcnally) on Fri May 29 12:23:59 1998:
 
   BTW, MIME is really just a scheme for telling your mailer what kinds of
   documents are attached and where they begin and end -- there's isn't a
   specific "MIME" representation scheme for turning binary files into text
   for transmission..  MIME-compliant mailers typically use uuencode, base64,
   or (less commonly) binhex to do that..
 
#203 C. Keesan(keesan) on Fri May 29 12:31:13 1998:
 The uuencode file started with Begin 600 filename.
 The mimed file, when downloaded, was readable in DOS but not in WP5.1, where
 it shows up as upper level ASCII.  Jim will see if he can remove some of the
 stuff at the beginning to make it readable.  I will e-mail the sender and
 ask if they sent WP5.1 or perhaps Word for Windows instead.

#204 Rane Curl(rcurl) on Fri May 29 13:06:09 1998:
 I downloaded Ge9495a.cec to my machine, uudecoded it there, and it opens
 as a WORD document. It is quite readable. I don't know why it did not
 decode on grex. Maybe their uudecode is obsolete? Would you like me to
 e-mail it to you as plain text?

#205 C. Keesan(keesan) on Fri May 29 14:05:25 1998:
 Rane, I cannot read WORD text.  They just assured me that it was sent as
 WP5.1, and that they have to encode by one of three systems when sending an
 attachment, or else add it to the body of the text.  Jim says their file
 starts with WPCG, and my WP5.1 files start with WPC7.  I will write again and
 ask if they might possibly have sent me a WORD file by error.
 
 I still don't know how to use uudecode.  COuld you possibly take the time to
 see if you can get uudecode working on grex, and if it is obsolete maybe
 someone could upgrade it?
 
 Jim tried to convert the demimed file from Word 4.0 to WP5.1 and this did not
 work.  What version of Word did you get?
 Thanks again.

#206 John H. Remmers(remmers) on Fri May 29 14:33:14 1998:
 As far as I know, the uuencode and uudecode commands on Grex are
 working. According to the man page, Grex's uuencode even claims
 to support base64 encoding.
 
 Re #202 (technical aside): uuencode isn't part of the MIME standard,
 so a MIME-compliant mail user agent isn't required to support it
 (although some do, I'm sure).

#207 C. Keesan(keesan) on Fri May 29 16:01:19 1998:
 The person who sent me the files claims they are in WP5.1, that this is the
 only wordprocessor that particular editor owns, and that she just opened them
 in WP5.1 to check.  Rane, did you also try to read the file in WP5.1?  Is it
 possible that by opening it in WORD, WORD automatically converted from
 WP5.1?  Does anyone who has WP5.1 want to try reading my (hopefully decoded)
 file mimea, which reads okay in DOS but is gibberish when I look at it in
 WP5.1 after donwloading it as a binary file?
 If Jim ever recovers enough from his viral infection to wake up, we can try
 sending the original WP5.1 file to his account, then e-mailing it from there
 to my account, and downloading to see what it looks like after that.

#208 C. Keesan(keesan) on Fri May 29 20:17:53 1998:
 Progress
 
 1.  We uploaded a WP5.1 file to my home directory, then e-mailed it to Jim's
 account using Pine (automatically encoded as MIME?), then Viewed and Saved
 it to his home directory, then downloaded (upload and download with Kermit,
 set file type binary) it to the computer here, and it came out the same as
 the files someone sent me (mimea is one of them, in my home directory).  In
 DOS it was readable, in WP51. is was lower and extended ASCII characters
 (8-bit).  It does not seem that saving from an attachment to the home
 directory with V and S automatically converts a file from its MIME coded
 format.  Can someone explain how to decode MIME using grex (and please try
 it out on my mimea file to be sure it works, or I can send you a WP51 file
 to your account, encoded using PINE, and you can try to find some way to
 decode it on grex.)
 
 2.  We then used the WP5.1 convert program to convert to 7-bit transfer
 format, did the same upload, mail, download with it, used the convert program
 to convert back from 7-bit format to WP5.1, and it worked perfectly.  So I
 can ask people to send me 7-bit transfer format, but it is 50% longer than
 the original file (maybe all coded files are that much longer) and therefore
 takes a lot omore of grex's time to download.
 
 3.  I would still like to know if there is some way to decode uuencode using
 grex, and please make sure it works on file Ge9495a.cec, which I am told was
 sent to me uuencoded.  What is a missing 'end' line?
 
 I hope it is appropriate to be asking these questions in this item, but there
 is a chance that it is a system problem.  Probably nobody else has ever tried
 to send binary files via grex, before we joined it was a 7-bit system, and
 a week after we asked Valerie how to send 8-bit files it became an 8-bit
 system, for which we are very grateful (and for which reason we joined).
 
 I will gladly donate $25 to grex (general purpose operating expenses) in honor
 of Valerie, Scott, Rane and other highly helpful grexers if someone can teach
 me how to decode uuencode, and another $25 for decoding mime, using only the
 resources available in grex.  (Valerie responded to our request for some way
 to send binary files, Scott came over and pointed out that we needed hardware
 flow control to use anything but Kermit, and Rane has been attempting to fix
 my decoding problems.)  It would be much appreciated ASAP, who knows when I
 will really need the ability to decode such stuff.  (Thanks also to Omni for
 his extended memory card and Kent for steering us to shroom software, it can
 be in their honor as well.)

#209 Dave Lovelace(davel) on Fri May 29 20:50:49 1998:
 One obscure-but-possibly-related point: to do a binary transfer, kermit needs
 *both* ends configured as binary.  You're doing "set file type binary" (on
 Grex I presume), but is your other end (Procomm?) configured for kermit to
 do binary file transfers?
 
 The "end" line is what tells uudecode that you've reached the end of the
 (encoded) file.  Let me go off & create & uuencode a (small) file as an
 example:
 
        $ echo this is a test > asdf
        $ uuencode asdf  < asdf > asdf1
        $ cat asdf1
        begin 644 asdf
        /=&AI<R!I<R!A('1E<W0*
        `
        end
 
 The "begin" line says that when the file is uudecoded it's to produce a file
 named "asdf" with 644 (rw-r--r--) permissions.  The following lines (in this
 case, 2 of them) up to but not including the "end" line are the encoded date.
 The end tells uudecode that this is the end of the file.  You can run
 uudecode on a file containing stuff before and after any of them, and
 it will use on the begin & end lines to determine where the uuencoded
 part begins & ends.
 
 So look at your (saved) message.  Does it include a line with "begin"
 at the very beginning of the line, having the structure of my example's
 "begin" line, followed by even-length lines of (apparent) garbage?
 Look at the end of it for a line consisting of "end" at the beginning
 of the line.

#210 C. Keesan(keesan) on Fri May 29 22:46:53 1998:
 Jim looked at the uuencode file and instead of 600 the first line read
 begin 600 filename  
 and the last line read
 end
 (all by itself).
 Is the 600 something that grex's uudecode program cannot deal with?  And why
 does it tell us No 'end' line?  The file is 60 characters long.
 Why was Rane able to uudecode it on his system, but it does not seem to work
 on grex?  Davel, could you look at thefile in question, Ge9496a.cec I think
 it was, in my home directory, and see if you can decode it while on grex?
 And if you can, what should I type in other than uudecode filename?  Rane said
 something about grex's uuencode manual instructions being wrong, someone (I
 am losing track) said they were right, but could someone simply try following
 the instructions to see if they work, then explain them for an idiot?
 
 The other problem remains what to do with the automatically mimed file (it
 is called mimea in my home directory, they sent it in a different coded
 format).
 Thanks to everyone for your time, and apologies for my ignorance, but I always
 seem to need to learn things in a hurry and don't have time to read up on it.

#211 Steve Gibbard(scg) on Fri May 29 23:33:18 1998:
 600 is the file permissions.  That means that the owner of the file (you) can
 read and write to it, but that nobody else can access it.  Having a number
 there is part of the UUencode format.
 
 
 I believe the end at the end is what's supposed to be there.

#212 Rane Curl(rcurl) on Sat May 30 01:50:59 1998:
 My WORD (Mac) 6.0 reads WP5 files. Anyway - do you want this file e-mailed
 to you as text - perfectly readable - or don't you? I don't know why
 uudecode on grex doesn't work. I used UUTool (Mac) on my machine. The
 man page for uuencode shows commands that don't work on grex: something
 is out of wack.
#213 Valerie Mates(valerie) on Sat May 30 16:06:53 1998:
 Sindi, try "uudecode < filename > newfile" to uudecode the contents of a file
 named "filename" and put the results in a file named "newfile".  I think you
 were leaving out the < and > characters in the command that Rane entered.
 
 Also, earlier, you were asking about when Grex stops in the middle of a line.
 I can think of a couple of things that might cause this.  One possibility is
 that you're in a program that needs you to press return after each line of
 text rather than typing off the right-hand edge of the line.  Another
 possibility is that one of the many newly installed programs on your computer
 is having some kind of intermittent conflict with other stuff on your
 computer.

#214 Dave Lovelace(davel) on Sat May 30 16:18:45 1998:
 OK, I think I see what your problem is.  This file came from a DOS source,
 and has extra carriage-return characters at the ends of all the lines.
 That's why uudecode isn't recognizing the "end" line - it's "end^M"
 not just "end".
 
 You're also going to have a problem trying to uudecode it, since the name of
 your file and the name to be given the uudecoded file (from the "begin" line)
 are the same.  It will overwrite before it's done reading, I think, leaving
 you with a partial file.  The simplest way to avoid this is to rename
 the original before uudecoding.
 
 Here are instructions for dealing with this, geared to this particular file.
 (There's a program, flip, intended for stripping out or adding carriage
 returns, but it doesn't seem to have survived the transition to the new
 system.  Thus the sed & pipe in what follows.)
 
 At a shell prompt:
 mv -i Ge9495a.cec Ge9495a.dos
 sed 's/^V^M$//' Ge9495a.dos | uudecode
 
 (The "^V^M" means to press control-V followed by control-M.  This should
 actually echo as "^M".)
 
 This will create the file Ge9495a.cec, which should be what you want.  You
 can then do a file transfer (binary) on that.

#215 Dave Lovelace(davel) on Sat May 30 16:23:22 1998:
 Valerie slipped in.  No, redirecting the output won't help;
 it's going to use the filename from the "begin" line (unless
 there's some kind of option to let you specify a different name).
 And redirecting input doesn't matter.  And the missing "end" is
 definitely the carriage-returns at the ends of the lines.
 I've tested this to make sure it all works, if you follow my
 instructions.

#216 Rane Curl(rcurl) on Sat May 30 23:52:29 1998:
 UUTool on my computer is apparently not bothered by extra ^M, since it
 decoded the file just fine. There must be an equivalent free utility
 for a PC. 
 
 It is even easier to use the command Valerie gave, but chose a different
 destination file name. 
 
 I did experiment with uuencode and uudecode here on a file in my
 directory, and they worked fine. So the problem is that grex's version
 is flummoxed by carriage returns.

#217 Mike McNally(mcnally) on Sun May 31 00:52:14 1998:
   Or, alternatively, that something else is sticking carriage returns
   in where they don't belong..
 
   Usually you get those pesky extra carriage returns when someone uses
   a binary transfer mode to move a text file (ever wonder *why* most
   transfer protocols have a binary mode and a text mode?  it's to take
   care of things like those CR/LF problems..)
 
   If you expected to be doing a lot of uudecoding of such files you
   could just alias your uudecode command so it would do sed with the
   right arguments piped to uudecode..
#218 C. Keesan(keesan) on Sun May 31 14:32:38 1998:
 Thanks to everyone, I have not tried any of this yet because I am waiting for
 Jim to wake up.  We both still have some sort of virus and Jim's response is
 to sleep a lot. Rane, thanks, I don't need this particular file as much as
 I need to know how to receive WP5.1 files via e-mail and decode them, so I
 will try to produce it on my own, but many thanks for proving that the file
 was in fact decodable with uudecode.
 re #211, if 600 means nobody else can access my file, how did Rane manage to
 decode it?
 re #213, we are trying one other solution to the problem of freezing up the
 screen (it happens all over the place, not just in MAIL, and even when I do
 hard returns every line, and may be worse in warmer weather).  We replaced
 an internal modem, which may be overheating, with an external one, and so far
 so good.  I have had no such problems except while online to grex.
 After we get uudecode working, it would also be nice to be able to read the
 MIMEd files, which could conceivably also have a hard return problem. 
 Hopefully with all these hints Jim can figure out that part.
 
 I don't understand 'alias' or 'piped', perhaps Jim knows their meaning.
 If any of you superhelpful people ever need any help reading a Slavic
 language, please call me first.  
#219 C. Keesan(keesan) on Sun May 31 15:24:53 1998:
 The freeze-up problem may have been the modem, as it did not happen in 40 min
 or so with the external modem.  But then I got disconnected, which I am
 guessing had to do with grex being overloaded.  I got disconnected a second
 time in 2 minutes, so now have a 2400 bps modem hooked up, Jim was convinced
 the disconnect was due to the other 14.4 modem.
        Instead of the mv command, I could, I think, simply rename the file
 to be uudecoded while saving it to my home directory.  We will now try to
 figure out what sed means, before applying this command.
#220 C. Keesan(keesan) on Sun May 31 16:03:10 1998:
 We looked up mv -i, which means to rename a file and have an interactive
 promprt, which asks us whether to overwrite any existing file by that name.
 We looked up sed, with is the stream editor, and the $ addresses the last
 input file.  We have not found '/^V//, but presume this means to delete all
 those ^M's at the line ends.  We are about to try out these commands.
 See you soon!
#221 Rane Curl(rcurl) on Sun May 31 16:36:51 1998:
 The file was permitted 644 in your directory. I think 600 would be the
 permission of the unix file after it is decoded.
 
#222 Mike McNally(mcnally) on Sun May 31 16:48:25 1998:
   yes, the 600 perms would apply to the *output* of uudecode, not the input..
 
   ^V means "take the next character literally" (i.e. instead of treating it
   as a special character like a carriage return or backspace..) so
   s/^V^M$// would "s"ubstitute a literal control-M at the end of the line
   with nothing, i.e. would delete it..
#223 C. Keesan(keesan) on Sun May 31 16:59:18 1998:
 Well, we followed the directions to use uudecode and delete the control M's,
 and, once I figured out that I could not send a file to a directory that
 already had a file with that same name (something to do with the Procomm
 settings, it will not overwrite but aborts, I deleted the original files
 there), we succeeded in sending the uudecoded three files (Ge9495a.cec, and
 the b and d versions) to my computer.  They can be read in DOS, just like the
 automatically decoded MIMEd files, but are still gibberish in WP5.1, in fact
 the uudecoded file looks identical to the mime-decoded file.  The first line
 reads something like:
 
 Nm'hn{^S.)=5<h k^Q,%4#;"0{9',ik*/<2^\.
 
 This is what I get trying to view the file in WP5.1, but if I try to download
 I get the message 'incompatible file format'.  SO now I have two ways to
 decode to the point where I cannot read the file in WP5.1.  What next?
 
 What is now in my home directory is the uudecoded versions Ge9495a.cec etc.
 and the decoded mimed versions mimea, etc., which seem to be identical.
 I don't understand the 600 and 644 stuff, am getting pretty confused by now,
 but does anyone still have WP5.1 for DOS, and could you possibly download oneo
 f these decoded files and see if it is readable in WP5.1, and tell me where
 I am going wrong?  MANY, MANY THANKS.  If the files are no longer accessible,
 tell me how to make them accessible.
 
 The first line of the files viewed in DOS is not actually text, but is stuff
 like happy faces, hearts, and other upper ASCII characters, and the command
 Prestige 12.
 
 While sending via Procomm, with Superkermit, after typing set file type binary
 on a separate line, then return, we were told that the file was being
 transmitted as TEXT.  Could the problem be with a Procomm setting?  We have
 had no problem uploading binary files with Kermit.  I may try downloading the
 same files with zmodem, but so far I have not been able to figure out where
 the files go when I use zmodem, they seem to be sending but just disappear.
 (Too much to learn all at once - new computer, new wordprocessor, new version
 of Procomm, unix, e-mail, grex....  I am having trouble keeping the unix and
 dos and wp commmands separate and tend to remove instead of delete, etc.)
#224 Rane Curl(rcurl) on Sun May 31 17:05:00 1998:
 When I recoded the file on my computer it appeared as a WORD text document.
 Are you sure it is from WP5.1? My system usually tells me it is translating
 a WP file. 
#225 C. Keesan(keesan) on Sun May 31 18:03:04 1998:
 We had the same problem when we sent ourselves a known WP5.1 file (upload,
 e-mail to Jim, view and save, download), so it cannot be WORD, we don't have
 WORD in theh ouse anywhere.
        We are attempting to download with zmodem, but when I type sz filename,
 give the send command (PgDn), specify parameters (drive name and file name),
 the system freezes up and I have to log off and on again.  Whatever we are
 getting after decoding certainly is not acting like a WP5.1 file at our end.
 Jim thinks that Word may automatically convert WP documents to Word.
 Well, back to the zmodem manual.  We seem to be pushing grex (and a few other
 programs) to beyond their normal limits.  We are downloading a binary (8-bit)
 file, but can't read it in WP5.1, just in DOS.  Maybe we have to change the
 settings on KERMIT?  It is downloading 8-bit, but says it is sending text.
        In the middle of this I got a chat request from Turkey, while using
 the external 9600 baud modem, and the screen froze up, so it does not seem
 to be a modem problem that freezes up the screen.
        Davel, did you download the decoded file and then view it with WP5.1
 for DOS?  If so, how did you download (Procomm, Kermit, or how?).
        Jim will set up a second computer the same as this one to see if that
 also has the freeze-up problem.  It is annoying but tolerable.  The inability
 to read decoded files may not be tolerable if people are not willing to both
 convert their WOrd files to WP for DOS and then also convert to 7-bit transfer
 format.  I am probably driving quite a lot of translation agencies crazy by
 using outdated software, but then there are not a lot of Slovene chemistry
 translators around who know English as wellas I do, so they are patient.
#226 C. Keesan(keesan) on Sun May 31 18:23:19 1998:
 We changed the kermit settings from TEXT to BINARY and downloaded the file,
 and it is now readable in WP5.1.  (I had thought the command Set file type
 binary would have taken care of that.  Do I continue to set file type binary?
 Do I set it binary for text files?).
 
 So now I can recognize and decode and read both uuencoded and mimed binary
 files, as well as sending Mimed files.  (I will not worry about learning how
 to encode with uuencode.)  We still don't know how to download with zmodem,
 but will read the manual for hints.
 
 I will now write out a check for $50 to the grex general fund, in honor of
 DaveL for teaching me how to uudecode, Rane for proving that the text was
 uuencoded and could be decoded, and everyone else who has helped me to make
 some sense of unix and other computer stuff.
 I would include here Marcus for his magnificent explanation of how binary
 logic works, Mike McNally for trying to explain a few other things (never sure
 whether I understand or not, but after a while it gets clearer), Jan for his
 extract program, Valerie for her immediate and detailed answers to a lot of
 beginner's questions, and anyone else I forgot to mention above.  I will
 probably continue to come up with questions, some challenging, some rather
 basic (read stupid?), and be grateful for the answers.
 
 I wonder why Kermit was uploading files as binary, but downloading as text.
#227 C. Keesan(keesan) on Sun May 31 18:56:10 1998:
 I don't think I had used Kermit to upload anything since we switched from
 Procomm to Procomm Plus (too many switches all at once -computer,
 wordprocessor, communications program and protocol - had been uploading with
 zmodem, and downloading with kermit but until now only text).
 
 The check is signed and in a stamped addressed envelope.
 
 My screen froze up this time while trying to access a website.
 
 Is there some version of uudecode that could be innstalled on grex that would
 take care of the line-end Control-M's, such as UUtool?
#228 Kent Nassen(kentn) on Sun May 31 21:16:58 1998:
 The dos2unix program is available for doing conversions.  Use that in
 combination with uudecode.  
#229 C. Keesan(keesan) on Sun May 31 23:26:19 1998:
 Ratheer than try to figure out how to use one more program, I will stick
 with Davel's one line ctl-M remover.
 
 I compared the first of the three files sent me with what I had sent to the
 translation company.  I had asked to see the copy after the chemistry editor
 finished with it.  I put my original file on screen 2 and the edited file on
 screen 2 and kept switching back and forth every line.  I found only about
 three changes, such as steam for water vapor and a couple of typos.  This did
 not seem worth the work to compare.  Now a friend just emailed me a uuencoded
 zipped program for comparing files.  I exported it from the message to my home
 directory under a slightly different name than what was in the header, and
 typed in the line with the ctl-M in it, and got out a file of the original
 name (it may still have the one line text intro, which I hope I can manage
 to delete) which looks decoded.  For some reason, I also got the message:
 
 uudecode:  stdin:  Short file
 
 What does this mean?
 
 Anyway, I have now been able to use uudecode on another binary file, in this
 case a zipped program.  (Still have to learn to use the program).
 
 The check is in the mailbox waiting for the mailman to pick it up.  
 Jim also figured out that you could transfer the printer files from a 3.5 inch
 floppy to two 5 1/4 floppies by zipping them, and we got me a printer
 definition working.  All that is left to do is to get zmodem to download,
 figure out why my screen freezes up so often, and it would be nice to have
 a monitor that can display graphics (Cyrillic alphabet) but first Jim wants
 to use the Hercules graphics plus card to fix another broken one, so I may
 get a VGA temporarily instead.  The end is sort of in sight, and at least I
 am prepared to send and receive binary files, which is what I originally
 joined grex for.  Many many thanks again to everyone.
#230 Marcus D. Watts(mdw) on Mon Jun  1 03:59:58 1998:
 "short file" means the file got truncated.  The "uuencode" format works
 something like this:
 
 first line:    "begin" mode filename
 N lines: each containing a non-zero character encoded byte count,
 followed by character encoded binary data.
 A line with a zero byte count, and no data.
 A line that contains the word "end", and nothing else.
 
 Binary values from 0 to 63 are encoded as follows:
 0 `    1 !     2 "     3 #     4 $     5 %     6 &     7 '
 8 (    9 )     10 *    11 +    12 ,    13 =    14 .    15 /
 16 0   17 1    18 2    19 3    20 4    21 5    22 6    23 7
 24 8   25 9    26 :    27 ;    28 <    29 =    30 >    31 ?
 32 @   33 A    34 B    35 C    36 D    37 E    38 F    39 G
 40 H   41 I    42 J    43 K    44 L    45 M    46 N    47 O
 48 P   49 Q    50 R    51 S    52 T    53 U    54 V    55 W
 56 X   57 Y    58 Z    59 [    60 \    61 ]    62 ^    63 ^
 
 Note there aren't any lower-case characters here.  When uuencode was written,
 there were plenty of systems around that automatically translated text from
 lower-case into upper-case.
 
 Since a binary byte contains 8 bits, but the above only encodes 6 bits,
 it takes 4 of these printable characters to store the information from 3
 bytes.  The encoding looks something like this:
 
 Binary data(hex):      4D      44      57
 (in binary):           010011010100010001010111
                        aaaaaabbbbbbccccccdddddd
 6-bit numeric values:  19    20    17    23
 character-codes:       3     4     1     7
 (This was probably not a particularly good example, as it is
 "coincidence" that the 4 characters, 3417, all happen to be digits.  All
 those other characters, including punctuation and letters, are also
 valid data.
 
 Each of these N lines must contain at least 1 character of data, but
 generally speaking, most lines will contain 45 bytes of data.  These 45
 bytes will expand out to 60 printable characters, and, with the byte
 count, that means most lines in a uuencoded file are 61 characters long.
 Each of these lines will also start with M, because M is the character
 that encodes the byte value of 45.  The line with the zero data count
 will contain one printable character, `, because ` is the character that
 encodes the zero byte count.  If the file isn't a multiple of 45 bytes,
 the last data line will contain fewer than 45 bytes.  If the file isn't
 a multiple of 3 in size, then the last byte of the file doesn't line up
 on a nice character boundary.  Now, it doesn't *really* matter what's
 done here, because uudecode will ignore whatever's put there, but what
 uuencode does is to pad the last character triplet out with "garbage"
 (actually, data from the previous data line), then write out 4 character
 values.  So, most lines in a uuencoded file will contain 1 mod 4
 characters.  Also, because uudecode ignores extra trash on most lines,
 there is only 1 line where a trailing control-M is bad -- the *last*
 line! So, rather than running the whole file through dos2unix, you can
 just use vi (or whatever) to delete the last control-M in the file.
 
 uudecode can complain about the following:
        uudecode: <file>: no "begin" line               -if the first line
        doesn't
                                                        start with "begin".
        uudecode: <file>: illegal ~user.                if the filename starts
                                                        with ~, but doesn't
                                       have a /.
        uudecode: <file>: no user <user>.               if ~so-and-so isn't on
                                                        this system.
        uudecode: <file>: path too long.                # if the expanded
        filename is
                                                        too long...
        uudecode: <file>: <operating-system-error>      if there's an error
        creating
                                                        the file.
        uudecode: <file>: short file.                   EOF before reading a
        data line
                                                        with a zero byte count
                                       (ie,
                                                the file dones't contain the
                                       line (`)
        uudecode: <file>: no "end" line.                the next line in the
        file
                                                        after ` doesn't say
                                       "end".
#231 Dave Lovelace(davel) on Mon Jun  1 08:52:47 1998:
 Sindi,
 (1) kermit usually needs to be set to binary on *both* ends - otherwise when
 the two ends negotiate they choose the least-common-denominator setting & go
 with text, & garbage your file.  This is dumb, but is the way it is.  So you
 need to set Procomm to use binary - which you should be able to do as a
 configuration setting & thereafter not need to do again, I think - and also
 do "set file type binary" on Grex's kermit.  (Or, to just send a file,
 invoke it as "kermit -is yourfilename", I think.  I don't use kermit much.)
 
 (2) What all Marcus said is (I presume) correct, & is interesting & useful,
 besides being way more than I ever knew about uuencode/uudecode.  But in
 your particular case I think you have one likely cause for the file truncation
 which yielded the "short file" error.  (I mentioned it earlier, but didn't
 stress it enough, I think.)  If the filename on the "begin" line in the
 uuencoded file is the same file name as the uuencoded file itself - which was
 the case with the one I looked at - the file will get overwritten before
 uudecode is done reading it.  That's why I put in the step to rename the file
 to a different name.
 
 (3) I'd recommend using the dos2unix program Kent suggested, instead of the
 sed command I gave you.  I was going to suggest flip (or its alias toix),
 but it apparently got lost in coming to the Sun4, and I didn't know about
 the (hopefully equivalent) dos2unix program.  You should probably read
 the man page on dos2unix (I just did so, & think you probably want the
 -ascii option).
 
 Better yet, you could write a script to rename your file, convert it, &
 send it all with one command.  Assuming that (as with the sample) the name
 your file was saved to is always the same as the name on the "begin" line,
 the following should work:
 
 #!/bin/sh
 # for each parameter, renames & uudecodes.  Then sends the entire batch
 # using kermit
 for filen in "$@"
 do
   echo Going to convert ${filen} now
   mv -i "${filen}" "${filen}.dos"
   dos2unix -ascii "${filen}.dos" | uudecode
 done
 echo 
 echo "... Going to send the following files, kermit binary mode:"
 echo "$@"
 kermit -is "$@"
 
 
 (You would still need to make sure that Procomm is set for binary kermit
 first.  Also, I'm pretty sure that kermit would send all the files on the
 command line, but I haven't tried it to make sure.)
#232 C. Keesan(keesan) on Mon Jun  1 10:12:54 1998:
 Thanks Dave, I did have to change the Procomm settings for Kermit from text
 to binary before I got readable flie (I think I mentioned this, but I dont
 write all that clearly), and I had saved the file from my e-mail message to
 a new file name instead of the one it decoded as, rather than using your
 mv command.  What I did not do was to remove the first line of my e-mail
 message saying something like :  Here is a file I am sending you.  This may
 have confused uudecode.  I will edit the message and reexport it (I had better
 delete it from my home directory first).  We will do that and see if we get
 the short file message.
        Is there any problem with uudecoding a file 140,000 bytes long?
        We will also attempt to look at the manual and learn to write our
 own unix programs, some day, or at least enough to understand what you wrote
 for us above.  (First we are attempting to figure out why my screen freezes
 up by putting me back on my old commputer, which I bought new in 1985 and
 which is known good, with the same new software, minus the shroom program,
 and if it all works, add the shroom program and if that works it was a flaky
 computer and I will use another one, we have a large choice of them).
 
 Marcus, as always, many thanks for the detailed explanation (which must have
 taken you at least an hour to write up typo-free, even if you knew this all),
 which we will extract and print out for further reference.  I vote that we
 start a separate archive item for this explanation and for a few of Marcus's
 other contributions, including the one on binary logic.  (In fact I would be
 happy to save all that Marcus writes, Marcus not only knows a lot about all
 sorts of things but writes about them so even a beginner can understand, but
 others probably don't find it boring).
        Unfortunately we do not have time to read and understand all the above
 right now, as we are supposed to be at Kiwanis at 9:00 fixing stuff.
        The inability to download with zmodem (it freezes up the screen) may
 be related to the other freezeup problem, we will try it on this computer.
 
 WOuld it be possible to at least add to the uudecode part of the manual a
 suggestion to use Dave's program (script) above if you get the error message
 no end of line (or whatever it was)?  Some day another person may try to use
 uudecode on grex and start this same discussion again, otherwise.  (And can
 Marcus' explanation be part of the manual?)
        Will report back as to whether we get this file to uudecode okay.
#233 Kent Nassen(kentn) on Mon Jun  1 19:28:33 1998:
 Re 231: I looked for flip, which I would also recommend (even over
 dos2unix for most uses, since flip will do in-place conversions where
 with dos2unix you need to redirect the output...although piping the
 output through uudecode might work better with dos2unix) but I couldn't
 find flip on grex, either.
 
 In general, unix is all about learning new programs since huge monolithic
 multi-functional apps are not welcomed, usually.  You get by by stringing
 two or more small commands together (and generally get more flexibility
 that way, too).  I wouldn't worry about learning the dos2unix command.
 It's just a drop in the bucket of all the commands you could learn, and
 if it helps you, do it.  You will be ahead in the long run especially
 if you use a unix system frequently.
#234 Military Insanity(senna) on Mon Jun  1 22:03:28 1998:
 One wonders what item it is I'm in.
#235 Dave Lovelace(davel) on Tue Jun  2 10:02:23 1998:
 Yes.  Sindi, I really don't think these are Grex system problems.
 The Info conference has been pretty near dead for quite a while now, but
 that's been a really good place, in the past, for trying to debug problems
 of this sort.  I'd suggest entering a few new items there.  (Or maybe I'm the
 only one who still has that in a .cflist.  <sigh>)
#236 John H. Remmers(remmers) on Tue Jun  2 11:31:38 1998:
 I have it in my .cflist too.
#237 C. Keesan(keesan) on Wed Jun  3 14:54:01 1998:
 Thank you all, still trying to decode DELTA.ZIP, but I got a book on UNIX (for
 dummies) from the library.  Will ask further questions in Info.



We managed to unzip the DELTA.ZIP file that was giving 'short file'
messages and it unzipped okay.  It is a collection of files.  We also
unzipped a file sent to us by Kent, which uudecoded and unzipped fine.  
So uudecode is working fine now.  Did not have to remove Ctl-M's from
these other two files.

Response not possible - You must register and login before posting.

No Next Item No Next Conference Can't Favor Can't Forget Item List Conference Home Entrance    Help

- Backtalk version 1.3.30 - Copyright 1996-2006, Jan Wolter and Steve Weiss