Probably the real error is “The Unicode Byte-Order Mark (BOM) in UTF-8 encoded files is known to cause problems for some text editors and older browsers. You may want to consider avoiding its use until it is better supported.”
Open header.php and resave it as Unicode text, unix line returns, no BOM.
Thank you for the response songdogtech.
I’ve never done that before, so I’m not sure on how to do it.
I’m using MS Expression Web as an editor and I don’t find an option to save-as unicode.
I don’t think Expression Web will do that. You need to use Notepad under Windows and an FTP clent. See Filezilla and FTP Clients « WordPress Codex.
Thanks again. I pasted the entire page of code (page-home.php) into Notepad, saved it as unicode, uploaded it the site using Filezilla and everything crashed.
I opened the file in Dreamweaver CS3 and it wanted to change some of the video code. So I allowed that and then did a save-as there and there’s an option checkbox to include Unicode with BOM. I unchecked that box and uploaded the file. Same error is mentioned plus a bunch more on the video code.
BTW, I don’t understand how transfering files via FTP has anything to do with resaving the file as “Unicode text, unix line returns, no BOM”
Transferring by FTP is the easiest way to do it. But try setting Notepad as the default editor for FTP, open the file from FTP and resave it as unicode, no BOM.
Thanks songdogtech. I’ve tried “editing” the file via the FTP and saving it a Unicode, Unicode big endian, and UTF-8 – there is not a “no BOM” option available in the save-as dialog box.
Only by saving the file as UTF-8 does the page not crash.
By the way, all interior pages validate and render fine even though they have the same “warning” about the unicode BOM. Logically, the unicode BOM issue is not the cause of the error else the error would be on every page.
I have commented out the video player and am now down to a single error and the single warning. Now, the only error is the same original issue I posted at the beginning of this thread:
The validator states the problem as having a “space” preceding the <!DOCTYPE html PUBLIC “-//. There is no space preceding that declaration and the header works fine on all interior pages.
Other actions that I have taken:
Searched the page-home.php file for any open or improperly closed tags. (Did not find any)
Copied the validator’s “fixed code” and compared it to the original and did not find a significant difference (only links or routines called by PHP vs hardcoded).
Uploaded the “fixed code” and it crashed the page.
Any other ideas?
Well, I fianlly got the page to render properly and discovered that using MS Expression Web or Dreamweaver somehow causes the error.
In an effort to discover what was causing the issue, I copied each line of code into a text file, uploaded it to the site, deleted the “page-home.php” file then renamed the text file to “page-home.php”. I did this one section of code at a time and then tested the site thinking that sooner or later one of those sections would create the error. That didn’t happen.
So, I downloaded the error-free file, edited it with a space in a commented section and uploaded it back to the server – wham! Same error!
So, I uploaded the text file and renamed it again then downloaded it and edited it in Dreamweaver, uploaded it and wham! Same error.
My conclusion is that the web editors are adding the erroneous (and invisible in any editor) code. Really disappointing because this doesn’t happen with any other sites/files I’ve worked with?!?
BTW, copy-all-paste-all from the PHP page to a text file doesn’t work either. The only thing that seemed to work is the copy-line-by-line/upload-as-txt-file/change-filetype-to-php.
Oh, one more thing. Notepad allows saving the file as ANSI, UTF-8, Unicode, and Unicode big endian. Only by saving the file as ANSI do I get correct rendering and no error.
Interesting that the editors add bad characters. I only use a plain text editor on OS X – called BBEdit – and only know from other experience to use Notepad under Windows. I have always heard that using Dreamweaver causes problems.
Might also be a difference in the hosting service. Is it windows or linux?
Linux. The big oddity is that none of the other sites/pages that I edit using either editor generate that error. Mystery…