Forum Moderators: coopster

Message Too Old, No Replies

IE picking up extra character in my pages

But FF doesn't see it

         

katana_one

6:33 pm on Feb 19, 2009 (gmt 0)

10+ Year Member



A site I created in php looks great in FF, but there's a problem in IE (big surprise!).

When I view source in IE there is a "box" character at the beginning of the code. When I view source in FF it isn't displayed.

IE doesn't center the page in the browser (css rule) while this character is present in the html. I know because I copied the source into notepad and created an html file and deleted the extra character.

Any idea what might be causing this? I've been going through my php line by line and found nothing so far.

Receptional Andy

6:36 pm on Feb 19, 2009 (gmt 0)



This sounds like a character encoding problem. Are you specifying the character set of the page? (e.g. with a meta element like the below within your document <head> area)

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

katana_one

7:17 pm on Feb 19, 2009 (gmt 0)

10+ Year Member



<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

whoisgregg

7:37 pm on Feb 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sounds like you may be saving the file with a BOM (byte order marker).

Your text editor should give you the choice of saving with "UTF-8, no BOM" or something similar. It may also be in your preferences to save with a BOM. Either way, get rid of it and you should be good. :)

katana_one

8:21 pm on Feb 19, 2009 (gmt 0)

10+ Year Member



I'm not sure I'm being clear here.

This stray character is NOT in the php code. However, it shows up in the source of the html returned from the server in IE ONLY. It shows up BEFORE the DTD. It is causing IE to ignore some of my CSS.

FireFox does NOT display this character in the source, and displays the page and all CSS correctly.

whoisgregg

9:53 pm on Feb 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can't see it in the PHP code, but it is part of the file. Basically your text editor adds the BOM and subsequently hides it from you. It's a special control sequence that says whether the file is UTF-8, UTF-16, or UTF-32.

Check your text editors settings. Or, if the file came from elsewhere, you may need to copy and paste all the visible php contents into a new "clean" file and replace the old file.

katana_one

10:16 pm on Feb 19, 2009 (gmt 0)

10+ Year Member



Ok, it's fixed. Not sure how it happened in the first place though - DreamWeaver's default setting is to NOT include the BOM in a new file, and I've never changed it.

But I created a new file and copied and pasted. Now it works.

Thanks for the help.

whoisgregg

2:11 pm on Feb 20, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No problem. Glad you got it sorted. :)