Your best friend for file transfer.

Fetch application logoFetch

Editing CGI files (6 posts)

  • Started 16 years ago by FamilyCorner
  • Latest reply 16 years ago from Scott McGuire
  • FamilyCorner Member

    I'm new to the Mac world, so please forgive me if anything comes out as ignorant.

    I used to use Cute FTP but I liked the option of WebView better on Fetch, so I bought this instead of that.

    I have been editing my files directly on the server for a couple of weeks now, still getting used to it, but it's been working fine. I have only been editing html files up until now. I am using Text Wrangler as my text editor to save directly back to the server.

    Anyway, today I opened a cgi file, made a change and saved. Bam, Internal Server Error :() So I clicked undo all the way through and saved again but it's still giving the same error. I've been editing this particular file for 6 years, so I know it's not something I did, but I am assuming that the upload process corrupted the file.

    I don't see an option for uploading/downloading in ASCII, but I do see "text". Forgive me, are those one in the same?

    How can I avoid this problem in the future? I thought I had all my settings and preferences set correctly, but I guess I don't :()

    Thanks for your help in advance!

    [This message has been edited by FamilyCorner (edited 12-13-2007).]

    Posted 16 years ago #

  • Scott McGuire Administrator

    Hi,

    Yes, Text format is the same as ASCII.

    And when you are using Fetch's Edit feature to edit a text file, the file is always uploaded as text (ASCII) again.

    It's extremely unlikely that Fetch corrupted the file when it saved it back to the server, and really there aren't preferences or settings you could set incorrectly for editing.

    Did you try viewing the file on the server using the Fetch View command? If so, did it look okay? That would tell you whether it's corrupted or not. If you see problems when you view the file after editing it, please let us know.

    If you are still experiencing problems - or if you experience this problem again - here's what I would do:

    * Make sure you have a known good copy of your cgi file on your Macintosh.
    * Connect to your server.
    * Delete the copy of the file on the server.
    * Go to the Remote menu, choose Format, and then choose Text from the Format submenu.
    * Upload the known good copy from your Macintosh.

    Test the webpage/cgi file. If you are still experiencing problems, use the Fetch View command to verify that the file has been uploaded without a problem. If you see errors in the file, let us know, and we will investigate. If you do not see errors when you view the file, then it was uploaded correctly, and the problem either lies with the server, or with the code in the file. (I would also make sure that your browser is not caching a bad copy of the cgi file; in Safari, use the Empty Cache menu item in the Safari menu.)

    Please let us know whether this helps or not.

    Thanks,

    Scott McGuire
    Fetch Softworks

    Posted 16 years ago #

  • FamilyCorner Member

    Thank you for the information. :) I ended up contacting my server, they in turn pulled a back up from a couple of months ago for me and it's working again.

    Is there some sort of activity log that is part of Fetch? i had my uploads and downloads set on automatic and am wondering if the saved file ended up getting uploaded in binary format. I'd like to go back and look if there's a log.

    Thanks!

    Posted 16 years ago #

  • Scott McGuire Administrator

    Hi,

    The only activity log that Fetch keeps is the Fetch Transcript window, and it is cleared out when you quit Fetch. Fetch does not keep a permanent long term log, sorry.

    So if this problem happens again, or if you have not quit Fetch in several days, you could consult the Fetch transcript to see which format the file was uploaded in.

    However, even if the file was uploaded in "Binary" format, that shouldn't be a problem for text files. Binary format means "upload the files exactly as they are on your Mac, without changing any information." For most text files, that is a perfectly fine way to upload them.

    The "Text" format only differs in that it will change the line endings in your text file to match the line endings on the server. This is makes the file easier for humans to read when it's viewed on the destination computer, but it should not affect how a cgi file is parsed. But the "Binary" format actually makes no changes to your file.

    The only formats that would be wrong for uploading a text file would be the archive and compressed formats - Zip Archive, Stuffit Archive, etc. - and Fetch will never use one of those when uploading a file when you're using the Edit command.

    And if you have been editing files using Fetch for several weeks with no problem, Fetch would not unexpectedly change upload formats. So I suspect the problem lies elsewhere than what format Fetch uploaded the file in.

    But please let us know if you run into the problem again, or if you have more questions.

    Thanks,

    Scott McGuire
    Fetch Softworks

    Posted 16 years ago #

  • FamilyCorner Member

    Thanks again. Now I'm wondering what did it, maybe Text Wrangler? Here's what my server guy said:

    "It appeared that the formatting of the file was changed, and it added some special characters and formatting. If you download the file and work with it locally, save your changes locally and compare the two to see what it does (before you upload the changes. Make sure the FTP transfer is set to binary encoding."

    Posted 16 years ago #

  • Scott McGuire Administrator

    Hi,

    Sorry for the delay in replying.

    If special characters and formatting were added, it probably happened in TextWrangler. None of the Fetch format settings should cause extra characters to get added on upload. Your server guy's suggestion to compare before and after files is a good one.

    While normally Fetch is set to upload files you edit with TextWrangler in Text format (which can change the line endings, as I previously mentioned), you can set it to upload them in binary format if you want.

    You can do this by going to the Fetch menu, choosing Preferences, clicking the Obscure tab, and then unchecking the "Use text mode transfers" checkbox. I don't believe this setting is likely to be related to the problem you experienced, but it also shouldn't hurt anything to try it if you want.

    One possibility that comes to my mind is that perhaps the text encoding of the file got changed while it was in TextWrangler (the text encoding says which character set or language the text file is using). If the encoding got set to one of the Unicode settings - UTF-8 or UTF-16 - that could have introduced some extra characters in the file that the server might not have understood. In the most recent versions of TextWrangler, the encoding is displayed in the info bar at the bottom of the window, and can be changed by clicking in the menu in the info window. Perhaps the text encoding got changed accidentally while you were in TextWrangler? Under most circumstances for a cgi file, you'd want the encoding to be "Western ISO-1," which should be the default encoding when you open files in TextWrangler by editing with Fetch.

    Let us know if you have further questions. Thanks,

    Scott McGuire
    Fetch Softworks

    Posted 16 years ago #

Reply

  • Or nickname, if you prefer.
  • This will be kept confidential.
  • This is to ensure that you’re a person, not a spambot.