Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

How to get rid of these characters: 

Shows on web page after replacing an include



5:01 pm on Apr 10, 2011 (gmt 0)

10+ Year Member

I'm updating another guy's website. He included the <title> tags in an include. So that I could optimize head tags, I copied and pasted the whole include where he had written

<?php include "incl_top.php"; ?>

Now on the page I get these characters:

I found a search result that says this is called a BOM or byte order mark. It says to stop this, make sure to save files using UTF-8 with the BOM turned off. But there are no UTF-8 files in the include.

The doctype is strict.
I get the same issue in IE8 with compatibility view both off and on.
Same issue seen in Foxfire.

This code is in the include:

<!--[if lte IE 7]>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />


5:06 pm on Apr 10, 2011 (gmt 0)

10+ Year Member

Firefox, not Foxfire. LOL. This issue has my brain fried.


10:03 pm on Apr 10, 2011 (gmt 0)

Some text editors preserve BOM when they see it in the file, although they might hide it from you while editing.

Try opening the file with some editor (for example Geany from geany.org) which is aware of the actual bytes used and allows you to remove them. Geany has an option "write Unicode BOM" in the document menu. Just uncheck that checkbox and save th file.


7:26 pm on Apr 11, 2011 (gmt 0)

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

Might check all charset declarations on the page. Best results if they are ALL the same.


8:39 pm on Apr 11, 2011 (gmt 0)

10+ Year Member

Thanks guys but nothing works yet. I'm going to restore the call to the include but remove the <head> tags only and hard code them instead on the page. See if that works.


11:13 am on Apr 13, 2011 (gmt 0)

5+ Year Member

If the file has only regular 7-bit ASCII characters in it (which is common), it is also legal UTF-8. An editor might have saved the file with the BOM at the top.

Notepad++ is another editor (for Windows) that can save the file without the BOM.

In one editor (unfortunately don't recall which), I discovered I could remove the BOM by putting the cursor at the very top of the file and hitting Backspace. Nothing visibly happened, but it got rid of the BOM.

A "hexdump" utility can show you the actual bytes in the file. It's "hexdump" or "hd" in Linux. Somewhere, there should be an equivalent utility available for Windows.


11:42 am on Apr 13, 2011 (gmt 0)

On Windows you can use Total Commander demo version. Open the file using F3 and select HEX VIEW from the menu.


8:51 pm on Apr 13, 2011 (gmt 0)

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

Using charset=utf-8 is by far the best approach as it degrades (embraces) charset=iso-8859-1

Make sure all statements are the same... mixing them will introduce all kinds of unexpected results.

Referring back to OP's statement of using cut and paste to work on the website, perhaps your editor is the cause... not the declared charset...


9:14 pm on Apr 13, 2011 (gmt 0)

UTF-8 is not a superset of ISO-8859-1 and many west-european characters (german, swedish, french, etc.) and some symbols (like Euro) would not display properly.


9:27 pm on Apr 13, 2011 (gmt 0)

10+ Year Member

I apologize for my delay in following through on this. A separate project deadline has come up.

But I've downloaded Notepad++ and have saved the files using ENCODING > SAVE TO UTF-8 WITHOUT BOM. I'll test them.

I never knew a problem such as this could exist. I'm going to have to rethink my naive use of regular Notepad for saving files. (Already got caught saving an XML spreadsheet in ASCII instead of the UTF-8 option).

Thanks for everybody's input.


3:28 am on Apr 21, 2011 (gmt 0)

Long time ago same thing happened to me. I moved some web files from my old computer to the new computer and all of the files had  :S

Featured Threads

Hot Threads This Week

Hot Threads This Month