Strange file behavior when saving

I have a custom admin section where I can save, edit, and upload files all coded with php. However, I have a problem that occurs only on Javascript files that I have saved. It only happens on occasion and it can occur without even opening and editing the file. It’s like it just mysteriously happens. Now the problem is every once in a while I will find a little ‘x’ appended to part of a javascript function

[SIZE="1"]×[/SIZE]timeFunction

which naturally causes the function to stop functioning properly. No pun intended.LOL.
Anyways has anyone ever encountered anything like this? In my 8 years of programming I’ve never seen this happen. It’s almost as if someone is hacking into the file and changing characters just to be malicious. However, viewing awstats shows that the file has not even been accessed. What could be going on here? Thanks in advance for any insight!

I’m not a javascripter, so the only thing that comes to my mind is that the file may contain garbage characters because of an encoding issue or corruption during the transfer or save.

Have you asked in the js forum?

No, I haven’t asked in the js forum yet cause the past couple of days, I’ve been having images disappear from my hard drive as well. Could the hard drive be going bad and glitching files on its’ own?

Is it possible you’re writing out the ASCII code for 215? Is 215 significant in some way?

I think you’d have bigger problems if it was a hard drive issue. I’d look into your scripts and see if there’s a bug that’s deleting those images, probably when some other action is being performed. Maybe you also have a bug that’s writing those x’s?

Well, I found out what was deleting the images, it was a defect in one of my scripts. I feel like a fool, but at least I found the prob with that. As far as some of the scripts getting altered, I installed and ran ClamAV and while it didn’t find any virus, it did find over 200+ ‘errors’ no details provided. Every since I ran ClamAv no problems yet and it was happening pretty consistently. So I guess only time will tell. Thanks to everyone for your input! I’ve always found good advice on sitepoint!