FTP Trashes My File!


I'm having a weird problem with a CGI script I'm trying to run on an Apache server.  The script runs fine on the server, but whatever I've tried doing to pull the file down trashes it completely.  The file is full of the source code which is surrounded by gibberish, mostly the symbols "^@".

Now before you give me the newbie answers, think about why this is a 200 point question.  I've been in web development for almost 10 years.  Yes, I'm downloading the file as ASCII.  I've pulled via ftp, sftp and I've ssh'd into the system and pushed it, and it still happens.  Thinking it was a Windows thing, I've tried keeping the entire file in a UNIX environment (well...OS X Unix, anyway) and nothing seems to work.  I can't pull it down without this corruption occurring.  

Can anyone think of something I might be missing?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Cat file to display and check it isn't corrupted at all.
Try to pack file with gzip and get it with ftp as binary file.

On the server, try doing

od -c scriptname

This will show you if you have any unusual characters that you wouldn't normally see.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
^@  do mean that these are binry zeros?
please check with od (as already suggested)
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

RaydotAuthor Commented:
Sorry, I can't check from home so y'all wont hear back from me until I return to work Monday....
RaydotAuthor Commented:
Oh wait, actually, two questions.  I actually did look at the file on the server and it looked exactly the same, so it's not something going on in transfer.  This leaves me to wonder how this thing can even run!  I unfortunately can't get a hold of the original developer since he's kind of an odd duck.

1)  Is it possible (although it seems unlikely) that I'm dealing with a compiled file?
2)  "od" is something I didn't think to do so thanks for that tip...is there a difference between "od" and "hexdump?"
RaydotAuthor Commented:
Good call Tintin, you helped me answer my own question.

Once I od'd it I could see that the file is a compiled C file.  So, of course, I'll need the source code to make any modifications.  It was an easy thing to miss considering the fact that the bulk of the .cgi file comes up as HTML.

Thanks for the help, everyone...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.