Ascii or Binary

Ascii or Binary

3
NewbieNewbie
3

    May 22, 2008#1

    Hello
    Does UltraEdit automatically compare the file type you're transferring against a list of known file types and set it to binary or ascii upload on its own or do you have to manually switch from Acsii to Binary every time you change from uploading say a php file to a jpg image.

    Thanks

    6,603548
    Grand MasterGrand Master
    6,603548

      May 23, 2008#2

      No, UltraEdit is not analyzing the file content or comparing it with a list of file types before uploading a file. But UltraEdit is capable to handle correct Unix text files which have only LF (line feed) as line ending instead of CR LF (carriage return and line feed) as DOS text files have. So best is to set once the binary transfer mode and use it for any type of file. Binary transfer mode means upload/download a file 1:1 without any changes. ASCII transfer mode means on download replace every LF by CR LF and on upload every CR LF by LF. You don't need this line ending conversion.
      Best regards from an UC/UE/UES for Windows user from Austria

      3
      NewbieNewbie
      3

        May 23, 2008#3

        Thank you Mofi
        I am a bit concerned after reading an article posted at http://www.webweaver.nu/html-tips/ascii-binary.shtml to quote from the article,
        If you upload images etc. as ascii you'll end up with corrupted files. Some browsers seem capable of figuring it out, but not all... and not all the time. Netscape is much more picky, so you'd end up with broken or missing pictures for your Netscape users. (Yup, I learned this the hard way :-o )

        Same thing with uploading text files as binary. While this is less important for html files, scripts will have a HUGE problem with it and will just not work. This is the most common cause of the "Server 500 Error - Malformed Headers", and other equally unlovely errors that have caused many a webmaster to bang their heads against their computers.
        can you please comment on this?

        Thanks

        262
        MasterMaster
        262

          May 23, 2008#4

          I think scripts is a very wide term. I have no problems with javaScript and PHP script files being converted to/from DOS/UNIX or having them uploaded to a Unix/Linux server binary thus perserving the DOS line endings, while I have had the occasional "Server 500 Error" when a Perl CGI-script was uploaded with the wrong line endings.

          In general I agree with Mofi: If there isn't a particular reason for converting to/from DOS/Unix (ASCII download/upload), use the binary upload and work with the "native" line endings your server demands/expects.

          6,603548
          Grand MasterGrand Master
          6,603548

            May 25, 2008#5

            Using the ASCII transfer mode for binary files like images is simply stupid because replacing every 0D 0A by only 0A on upload or every 0A by 0D 0A on download will surely corrupt a binary file like an image.

            For text files this line ending conversion makes sense for those Windows programs which are not capable handling text files with Unix line endings. But UltraEdit can handle Unix text files. On the other hand up-to-date interpreters for Perl, PHP, ... on Unix servers handle scripts with DOS (Windows) line endings without any problem. The days that Unix progams failed on scripts with DOS line endings are years ago. So nowadays the main reason for using only the line feed for end of line is only to save 1 byte per line.

            So once again use always the binary mode. Don't forget for new files to convert them to Unix before uploading or if you create with UltraEdit only text files for webpages select UNIX for the setting Default file type for new files. Enable also setting On paste convert line endings to destination type (UNIX/MAC/DOS). In the status bar at bottom of the UltraEdit main window you can see which line ending format the current file has.
            Best regards from an UC/UE/UES for Windows user from Austria

            3
            NewbieNewbie
            3

              May 25, 2008#6

              Thank you both for your informative responses.