Re: ASCII text garbled on FTP download?

From: Bill S. (ziphem_at_hotmail.com)
Date: 04/16/04


Date: 16 Apr 2004 12:53:06 -0700

Ok, this helps. Thanks for the advice. btw when I go to dosshell and
edit the 1.cgi, it's formatted ok. So the problem is my notepad.exe

The reason why I use notepad is it's easier, as the files are sitting
on my computer. As the webpages I have get bigger, I've started to
back them up - tar them and ftp the tars to my Windows machine to
store them there - cause the thought of re-uploading everything,
permissions, etc., makes me ill.

As for the unix2dos, I need to install that on my server. If I run
the command for all files in the directory, will it destroy any
non-text files, like gifs etc?

Thanks!!!

>
> Or you can convert a CR to CR+LF file on windows using the following trick.
>
> Start,run,cmd
>
> "edit 1.cgi"
> add 1 space,backspace 1 space <ALT> F X <Return>
>
> Thats file,save,yes write changes. The file is now CR+LF terminated lines
> and works in windows.
>
> As I have already mentioned the problem is probably the ftp client or
> configuration of one of the ftp servers. As a rule don't move things
> around in ASCII.
>
> If you make it all CR+LF formatted and move it around in binary the
> problem goes away ...
>
> I would ask why anybody would write cgi sitting using notepad on an XP
> machine anyway !!!!
>
> If you cant live without XP use vmware to run a linux inside it, then you
> can write,edit and test cgi content... or dual boot the laptop... or even
> use knoppix to CD boot the laptop into a linux environment. Why would you
> want to edit the files in one place and run them in another, sounds a slow
> and clunky way of working to me.
>
> I've worked in a mixed windows/linux/unix world for years with none of
> these problems - you simply need to re-consider the best way to work -
> moving files around one at a time is a symptom of an ill-planned work
> pattern.
>
> I use a local linux machine to run apache and cgi - I connected to it
> using a laptop running knoppix and wireless networking when im not at my
> desk and I only ftp complete projects in binary... i've not had problems
> at all.
>
> Jon

root <root@home.com> wrote in message news:<pan.2004.04.16.14.57.48.807047@home.com>...
> On Fri, 16 Apr 2004 02:55:02 -0700, Bill S. wrote:
>
> > Thanks for the response. Ok basically my question is about carriage
> > returns. What I meant in they "never come out of linux" is this: I
> > sit here at home on my Windows XP machine. I want to move my files,
> > say 1.html, 1.gif and 1.cgi, from Server 1 to Server 2, both 3,000
> > miles away from me, and away from each other. The files are in /home
> > on Server 1 and I want to put them in the same location on Server 2
> > (/home).
> >
> > I ssh into Server 1. I cd /home, and type "tar cvf compressedfile *"
> >
> > I exit.
> >
> > I ssh into Server 2. I:
> > mkdir /home
> > cd / home
> > ftp
> > open Server 1, login, cd /home
> > get compressedfile
> > exit
> >
> > Ok, so then I "tar xvf compressedfile"
> >
> > I have then, in Server 2's /home, 1.html, 1.gif, and 1.cgi
> >
> > I exit ssh, all done.
> >
> > Ok, I am still at my Windows XP pc as the weather is bad and I don't
> > want to go outside. I have no umbrella, and I hate getting drenched.
> >
> > I then run ws_ftp. I have 1.html, 1.gif and 1.cgi in my ws_ftp
> > directory. Originally, 7 years ago, I uploaded them to Server 1,
> > 1.gif in binary and 1.cgi and 1.html in ASCII.
> >
> > So to remember what 1.cgi looked like, I go to view, & it's opened in
> > notepad.exe. I see:
> >
> > Version Info ###
> > $YaBBversion = '1 Gold - SP 1.1';
> > $YaBBplver = '1 Gold - SP 1.1';
> >
> > if( $ENV{'SERVER_SOFTWARE'} =~ /IIS/ ) {
> > $yyIIS = 1;
> > $0 =~ m~(.*)(\\|/)~;
> > $yypath = $1;
> > $yypath =~ s~\\~/~g;
> > chdir($yypath);
> > push(@INC,$yypath);
> > }
> >
> > ### Requirements and Errors ###
> > use CGI qw(header cookie); # so we can use the header and cookie
> > printing
> > use CGI qw/:standard/;
> > $CGI::HEADERS_ONCE = 1; # Kill redundant headers
> > require "Settings.pl";
> > require "$language";
> > require "$sourcedir/Subs.pl";
> > require "$sourcedir/Load.pl";
> > require "$sourcedir/Security.pl";
> >
> >
> > I ftp into Server 1, download 1.cgi in ASCII and view it, and see the
> > same as 1.cgi originally on my Windows XP, from 7 years ago.
> >
> > I ftp into Server 2, download the file in ASCII, the same way. I see
> > something a bit like:
> >
> > Version Info ###$YaBBversion = '1 Gold - SP 1.1';$YaBBplver = '1 Gold
> > - SP 1.1';
> > if( $ENV{'SERVER_SOFTWARE'} =~ /IIS/ ) { $yyIIS = 1; $0 =~
> > m~(.*)\\|/)~; $yypath = $1; $yypath =~
> > s~\\~/~g; chdir($yypath); push@INC,$yypath);}### Requirements and
> > Errors ###use CGI qw(header cookie); # so we can use the header and
> > cookie printinguse CGI qw/:standard/;$CGI::HEADERS_ONCE = 1; # Kill
> > redundant headers require "Settings.pl";require "$language";require
> > "$sourcedir/Subs.pl";require "$sourcedir/Load.pl";require
> > "$sourcedir/Security.pl"; # Those who write software only for pay
> > should go hurt some other field. # - Erik Naggum
> > &LoadCookie;
> >
> >
> > When I pasted the above directly here, in this window, it formatted
> > like how it looks from Server 1 or on my Windows XP. However, sitting
> > in notepad.exe, even cut and re-pasted, the formatting is garbled, in
> > that the carriage returns do not display well.
> >
> > So I was wondering why this was the case and if there is anything I
> > can do about this, rather than cutting out the ill formatted ascii
> > files, pasting them somewhere to get the formatting back, then
> > repasting them into notepad, and re-uploading them.
> >
> > Thanks!!
>
> Yes, you can zip the files up on the linux machine, ftp them in binary and
> unzip them on the windows machine. ("man zip" NOT gzip)
>
> If you want to edit the files on windows they must always be in CR LF
> (DOS) format.... so use
>
> "unix2dos 1.cgi" etc on the linux machine to force the files into CR+LF
> terminated lines (apache wont care). Then ALWAYS transfer ALL files in
> binary.
>
> Or you can convert a CR to CR+LF file on windows using the following trick.
>
> Start,run,cmd
>
> "edit 1.cgi"
> add 1 space,backspace 1 space <ALT> F X <Return>
>
> Thats file,save,yes write changes. The file is now CR+LF terminated lines
> and works in windows.
>
> As I have already mentioned the problem is probably the ftp client or
> configuration of one of the ftp servers. As a rule don't move things
> around in ASCII.
>
> If you make it all CR+LF formatted and move it around in binary the
> problem goes away ...
>
> I would ask why anybody would write cgi sitting using notepad on an XP
> machine anyway !!!!
>
> If you cant live without XP use vmware to run a linux inside it, then you
> can write,edit and test cgi content... or dual boot the laptop... or even
> use knoppix to CD boot the laptop into a linux environment. Why would you
> want to edit the files in one place and run them in another, sounds a slow
> and clunky way of working to me.
>
> I've worked in a mixed windows/linux/unix world for years with none of
> these problems - you simply need to re-consider the best way to work -
> moving files around one at a time is a symptom of an ill-planned work
> pattern.
>
> I use a local linux machine to run apache and cgi - I connected to it
> using a laptop running knoppix and wireless networking when im not at my
> desk and I only ftp complete projects in binary... i've not had problems
> at all.
>
> Jon



Relevant Pages

  • Transfer problems between Linux and Windows machine
    ... I am having some strange issues with transfer speeds between my linux box ... The windows boxes transfer fine between each other.. ... Download using FTP Firefox-win32.zip from ftp.mozilla.org: ... ON WINDOWS MACHINE: ...
    (comp.os.linux.networking)
  • Re: Crossover / Wine cannot install Office
    ... There will never be a Linux equivalent of Access, ... The formatting might not be exactly right, or the fonts might be off. ... how your hands are tied by "compatibilty" with "others". ... will be *just like Windows* so you can escape the clutches of Bill ...
    (comp.os.linux.misc)
  • Re: [SLE] attached .doc files problem (9.1)
    ... but the formatting seems to be OK. ... Must I go back to Windows? ... since Linux will not allow me to write to the NTFS system. ...
    (SuSE)
  • Re: Which Distro.
    ... > have to ability to use my Linux box for both workstation and server. ... > and ftp servers. ... > as plug and play and like a windows attitude. ...
    (alt.os.linux)
  • [SLE] attached .doc files problem (9.1)
    ... Linux on their web-site. ... but the formatting seems to be OK. ... Must I go back to Windows? ... since Linux will not allow me to write to the NTFS system. ...
    (SuSE)