Reputation: 185
hi i have done something to my website and now im getting an anoying bom character appearing on my site, i recently was adding to my header meta tags in my header and now im getting these stupid characters appearing on my site called Byte order marks, ive tried everyything to remove them but they wont go, please help.

i recently added this to my header.php file and i think because its saved it in utf-8 or something its doing this? not sure.
<meta name="robots" content="index,follow" />
<meta name="msnbot" content="NOODP" /><meta name="googlebot" content="NOODP" /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="content-language" content="en-GB" />
Upvotes: 0
Views: 1160
Reputation: 3573
Web servers don't know how to ignore them. You have to find the recently edited files and remove them.
The file was edited with an editor that automatically inserted the characters. You have to use a different editor to open and re-save the file. (Or figure out how to reconfigure your editor). Some editors have options to save files either with or without the bom.
If you're on *Nix, use this command to find and remove all the markers under a directory
find . -type f -exec sed '1s/^\xEF\xBB\xBF//' -i.bak {} \; -exec rm {}.bak \;
If you just want to find them:
grep -rl $'\xEF\xBB\xBF' .
Upvotes: 1
Reputation: 2112
According to this (http://www.w3.org/International/questions/qa-byte-order-mark.en.php), a BOM in a PHP include file will cause issues (they say it will cause a blank line). They recommend that files to be included by PHP do not include a BOM. How you remove that from your header.php file depends on your text editor. For example, Notepad++ on Windows has an Encoding menu, from which you can select "Convert to UTF-8 without BOM".
Upvotes: 1