Loading ...
Sorry, an error occurred while loading the content.

Re: ASCII/binary endline character trouble

Expand Messages
  • timothy adigun
    Hi Fred, ... I don t know the version of FileZilla you have, but I believe you could download a new one for use. I use version 3.5.1, I think the recent one is
    Message 1 of 2 , Mar 26, 2012
    • 0 Attachment
      Hi Fred,

      On Mon, Mar 26, 2012 at 11:50 PM, hOURS <h_ours@...> wrote:

      > Thanks. I do see the "Transfer Type" option under the "Transfer" menu,
      > but it's grayed out and I can't use it.
      >

      I don't know the version of FileZilla you have, but I believe you could
      download a new one for use. I use version 3.5.1, I think the recent one is
      3.5.3. Please google it.

      >
      > I also tried modifying the first line of my code. Instead of using the
      > ASCII value and the chr function, I cut and pasted the vertical rectangle.
      > So the line became:
      > $sillyrectangle = "";
      > (with said rectangle between the quotemarks - it won't show up in this
      > e-mail)
      > Needless to say, that didn't work either.
      >

      Please, allow me to think aloud, since we couldn't get how this "vertical
      rectangle" character looks like (or your input file) maybe you could use
      both "ord" and "chr" functions in Perl to *pick* each word or character (as
      the case maybe) in your while loop used for reading the original file you
      downloaded from your site. This could give you the numeric value, you can
      use for your "$sillyrectangle" using chr function. However, you must note
      that ord function will only return the numeric value of first *character*
      of your EXP, in case you try using word on the function.

      lastly, I don't know if it works perfectly for you. You could also look
      into unpack and pack functions, using "B*" Template for conversion; like:
      while(<>){
      print unpack "B*",$_; ## output in binary files and pack reverses
      }

      I hope any of this suggestions helps. But really if you ask me I will
      say, download and do a fresh installation of FileZilla.

      >
      > Fred
      >
      > --- On Sun, 3/25/12, timothy adigun <2teezperl@...> wrote:
      >
      > From: timothy adigun <2teezperl@...>
      > Subject: Re: ASCII/binary endline character trouble
      > To: "hOURS" <h_ours@...>
      > Cc: "Perl Beginners" <beginners@...>, perl-beginner@yahoogroups.com
      > Date: Sunday, March 25, 2012, 9:35 PM
      >
      > Hi Fred,
      > Please, check my comments and possible solution within your mail.
      >
      > On Sun, Mar 25, 2012 at 11:45 PM, hOURS <h_ours@...> wrote:
      >
      > Hello all,
      >
      > I write CGI scripts for my website in PERL. When I used to upload them
      > with my FTP
      > The programming language is Perl not PERL.
      >
      > program I made sure to do so in ASCII mode rather than binary. My host
      > made me switch to sFTP however. I use FIlezilla, and can't for the life of
      > me find out how to choose the mode on that. Unfortunately, binary is the
      > default mode. I don't like programming when the file displays ASCII
      > endline characters. I'd rather see clear, distinct lines rather than one
      > long line broken up with those vertical rectangles. When I download a
      > script from my site for editing it looks terrible. So I wrote a little
      > program to fix that:
      >
      >
      >
      > open (NEW, '>niceviewscript.pl') or die "Couldn't open file for writing";
      > I think is better to use open() three arguments like:
      >
      > open(my $fh,">",'niceviewscript.pl') or die "Couldn't open file for
      > writing: $!";
      >
      >
      > open (FILE, 'script.pl') or die "Couldn't open file for reading";
      > ## same thing here too
      >
      >
      > while (<FILE>) {
      >
      > $line = $_;
      >
      > chomp($line);
      >
      > print NEW "$line\n";
      >
      > }
      >
      > close (FILE); ## close($fh) or die "can't close file:$!";
      >
      > close (NEW);
      >
      >
      >
      > It works great. How do I get it to go in reverse though so it will work
      > when I upload it? I figured out that the ASCII number for those vertical
      > rectangles that represent line breaks was 10. So I tried:
      >
      >
      >
      > $sillyrectangle = chr(10);
      >
      > open (NEW, '>workingscript.pl') or die "Couldn't open file for writing";
      > ## same as above
      >
      >
      > open (FILE, 'niceviewscript.pl') or die "Couldn't open file";
      > ## same thing here
      >
      >
      > while (<FILE>) {
      >
      > $line = $_;
      >
      > chomp($line);
      >
      > $withnewend = $line . $sillyrectangle;
      >
      > print NEW $withnewend;
      >
      > }
      >
      > close (FILE);
      >
      > close (NEW);
      >
      >
      >
      > Why doesn't this work? The newly created file looks just like the old
      > one. Now, if anyone can tell me how to upload in ASCII mode (assuming
      > that's even possible) that Possible Solution:
      > Launch your FileZilla Program, click on the menu bar "Transfer" menu,
      > then check your sub-menu bar "Transfer type", you should be able to change,
      > your mode. I preferred to leave mine as "Auto"!
      >
      > will solve my problem even better of course. But now I'm curious as to
      > why my program for switching back doesn't work.
      >
      >
      >
      >
      > Thank you!
      >
      > Fred
      >
      >
      > --
      > Tim
      >
      >
      >


      --
      Tim


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.