Forum Moderators: open

Message Too Old, No Replies

Corrupt files - caused by editor applying incorrect coding?

Cookies fail because php produces output before header

         

HarryM

7:52 pm on May 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have been testing cookies on part of my site for some time, but when I rolled them out across the whole site certain pages gave errors. Cookies could not be set because the pages had already started to output.

The page files in question were no different to any others, consisting of a number of PHP variables and a PHP require command for the standard template. The pages validated OK, and the header checked OK.

The problem was cured when I recreated a fresh page file using Notepad. I suspect the probable cause was because I had globally edited all the corrupt pages using TextPad.

Some of the pages include text in GB and Big5 Chinese encoding, and this presents no problem to Notepad which saves them in ANSI automatically, but it seems that TextPad cannot handle this although it gave no warning.

Does anyone know of an editor that doesn't screw up such files and has a global replace facility?

And anyone know of any software I can run my files through to check for any corruption? Note the files work OK in browsers and validate even if corruption has been introduced.

bcolflesh

7:56 pm on May 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sounds like you accidentally placed a Windows carriage return or other "invisible" character into your pages - any good editor should have a DOS -> UNIX converter which you could run on the affected files.

I like UltraEdit:

[ultraedit.com...]

HarryM

8:23 pm on May 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, I'll give UltraEdit a try.

As you say, probably invisible characters, but not from Windows. The files were originally created in Notepad and have never been near Word or anything like that. The only ones that give problems are those that were later globally edited in TextPad. Just simple changes like the names of variables, etc.

I doubt it's a DOS/UNIX problem. More likely TextPad saved them in some variety of Unicode. Or else it just screws up pages anyway. :)

HarryM

1:09 am on May 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



bcolflesh,

I've installed and tried UltraEdit and so far it looks impressive.

Just one question - how do I stop it being the default editor when I want to look at source files in my browser? They sneaked that one in without warning!

HarryM

12:03 pm on May 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Found instructions to alter registry with UltraEdit forums search. Definitely a black mark against UltraEdit for making me have to go through all that...

Back to topic: anyone know any way of checking files for invisible corruptions?

Mod,

Should I re-post this in the "Asia and Pacific Region" forum, where they may have more experience of files containing GB and Big5 encodeings?

HarryM

6:02 pm on May 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Another black mark for UltraEdit.

I used Windows Explorer to create a new folder and then copied into it about 10 gifs. Found something had also created .bak copies of the gifs in the folder, which could only be UltraEdit.

UltraEdit uninstalled. I haven't got time to bother finding out how to turn off features I never wanted in the first place.

Found 2 of the gifs were corrupt and had to remake them in photoshop. UltraEdit? TextPad? I never have these problems with Notepad.