PDA

View Full Version : Notepad Formatting Problem! Very urgent please help!


TheTot
03-06-2009, 02:43 AM
Okay, I'm trying to be as specific as possible.
ANY HELP WOULD BE VERY APPRECIATED! We really need to fix this problem!! ANY SUGGESTIONS will be tried!

I am the webmaster/owner of a website. I co-manage this site with a close friend mine who lives a few states away. We keep in close contact all the time, so there's never really any trouble. We both use the same FTP account to access and edit the website files. We both use Notepad to edit the .html's, .php's and .js's that are used on our site.

MY hypothesis is that is has something to do with the fact that HE is running Windows Vista, and I am running Windows XP Professional. But again, we're looking for any way to solve this problem.

Okay onto the real crisis:
Apparently, this is only happening to me. Let's say I access our FTP, and download one of the files. Say, index.php. Then I go ahead and edit it with Notepad. For the sake of this demonstration, let's say I don't change anything, all I do is re-save the file by pressing CTRL+S. (Or even File->save / File-Save As.. Neither prevents this problem).

Here is the file when I downloaded it (As in, this is how it's supposed to look)
http://img4.imageshack.us/img4/6810/codescreeniecorrect.gif

Here is the file RIGHT AFTER I save it (Keep in mind I don't even have to edit the file, just resave it)
http://img18.imageshack.us/img18/3554/codescreenieincorrect.gif

This is obviously a big problem. By the way, if I save the file as the second image (all jumbled together), and upload it to the FTP, and my partner downloads it then opens it, it's still jumbled. However, if he re-uploads his non-jumbled version and I re-download it, and open it, and re-save it, it still jumbles. So again, the only thing I can think of is this is some Vista/XP problem.

We've tried a lot of things, but if you have ANY idea no matter how silly it seems why this may be happening, PLEASE tell us your opinion because we DIRELY need to prevent this from happening.

tomws
03-06-2009, 03:48 AM
The obvious thing to do would be to confirm that the both of you are using the same encoding when saving the file.

Not sure why you're bothering with Notepad anyway when there are a thousand better tools freely available. If you're stuck in the Notepad mindset, though, have a look at Notepad++ (http://notepad-plus.sourceforge.net/uk/site.htm).

TheTot
03-06-2009, 03:52 AM
We did check the encoding, and we both save with ANSI encoding.

I also forgot to mention it, but I thought this was peculiar. It only does it with .txt's, .php's and .html's. It does NOT do it to .js's, they're all fine.

tomws
03-06-2009, 04:13 AM
Curious. Do you both have file associations set up for all 4 file types?

TheTot
03-06-2009, 04:16 AM
Well, he does most of the PHP coding, as I am new to it and just dabbling. So he has WAMP installed on his computer, so he can view PHP pages right on his computer.

I can't, so I associated .php's right to notepad so I could just double click.

As for .txt's and .html's, they should both be default for both of us. .txt's open with Notepad and .html's open with our default browser, which both of ours is Firefox.

(I'm checking out Notepad++, by the way, hoping this could fix it. Also notable, I ran a test with another one of my friends running Vista, and it's not a Vista<->XP problem.)

godofreality
03-06-2009, 04:19 AM
my php files also open in notepad instead of the browser even though i have wamp and for the record i am the other person he is referring to

TheTot
03-06-2009, 04:42 AM
Okay some new info:
(Loving Notepad++ by the way, no idea why I wasn't using it before. Thanks for the suggestion)

Both Godofreality (my partner) and I downloaded Notepad++. We JUST did this like twenty minutes ago. We didn't even have the time to change any settings or anything so everything we're doing is default.

We have a file called "why.php"

He opened it with his Notepad++ and it looked absolutely fine. He resaved it, making no alterations, just for the sake of confirmation that this file looked normal and was supposed to be normal.

He uploaded it to our FTP, and I then downloaded it. I opened the same file that he checked, resaved and uploaded to our ftp no more than five minutes ago, and mine looks like this:
http://img164.imageshack.us/img164/1181/codescreenieincorrect2.gif

Yeah, you guess it, we didn't put all those blank lines in there. So I am yet again convinced this is some sort of Vista<->XP error.

However I do think it might be relevant that he is using a CoffeeCup brand ftp program (I believe) and I am using a program called CoreFTP Lite.

NO idea why the ftp program would make a difference but to be quite frank I am entirely dumbfounded by this whole situation so I thought I'd mention it.

TheTot
03-06-2009, 06:02 AM
Alright sorry for the double post but no one else had commented and I have more info.

I made a file in Notepad++, very simple, saved it as MyTest.html
At the same time, godofreality made a file in Notepad++ named HisTest.html

We put both on the ftp

He downloaded MyTest.html, added some content to it, saved it, and reuploaded it to the ftp.

Here's where it gets interesting.

The file that he created (HisTest.html) and put straight on the ftp appears incorrectly on my computer, with those funky linebreaks between every line.

However, the file that I created (MyTest.html), was fine. Even after he downloaded it, added content, resaved it, and then reuploaded it, it appeared fine on my computer. Everything I put there and even the content he added were all formatted correctly and fine.

I am so confused... Again, anyone able to offer even slightly relevant info, it will be very appreciated!

tomws
03-06-2009, 02:18 PM
Ah, FTP client transfer mode, perhaps?

A little Googling found these notes (different clients, but probably the same issue):

http://www.codeproject.com/KB/IP/FtpClient.aspx?display=PrintAll&fid=225949&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=76&select=2659037

If you are uploading a file using binary transfer it should upload the file as-is, without modification.

If you are uploading an MS-DOS file remember this is delimited with CR-LF pairs, whereas un*x/linux uses CR only. If you downloaded using CuteFTP using text mode it would treat the CRLF as two CRs

http://stackoverflow.com/questions/554960/how-can-i-stop-filezilla-changing-my-linebreaks
what FTP transfer mode do you use? I'm not 100% sure but I think if you force binary mode you should not have the problem.

oracleguy
03-06-2009, 04:26 PM
tomws is right on the money here. Notepad++ can handle unix linebreaks, notepad cannot which is why it looked like everything was on the same line.

TheTot
03-06-2009, 08:58 PM
Thanks everyone, it was indeed the ftp clients! I can't believe it! >.<;

Thank you all so much!