Welcome to WebmasterWorld Guest from 34.204.203.142

Forum Moderators: open

Message Too Old, No Replies

Firefox adding strange characters to my web page

     
8:53 pm on Sep 3, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 25, 2003
posts:2528
votes: 0


I have:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>

at the start of the page's coding, but in a view source in Firefox it shows as:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>

obviously this displays the characters  on the actual page and pushes the rest of the page down a couple of notches. This occurs for every page of the site. This is the only site Firefox has even done this to that I've written and it doesn't happen with IE or Opera. Any clues?

1:17 am on Sept 4, 2005 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9074
votes: 6




It's a character encoding issue. Those three characters are: 0xef 0xbb 0xbf (or U+FEFF, a zero-width, non-breaking space) in Unicode, but represented in ISO-8859-1. This is a Byte Order Mark [en.wikipedia.org], probably added by Notepad or similar Windows program which saved the file as UTF-8. However I assume you are serving it as ISO-8859-1, probably from a server running Linux or another Unix, hence the confusion.

Basically, Notepad claims to support UTF-8, but it adds the byte order mark even though it shouldn't. Luckily, most other more advanced text editors (textpad, etc. as well as wysiwyg editors such as Dreamweaver) can cope with UTF-8 just fine. To fix your problem, the page needs to be resaved in with the right character encoding. If it is a static page, copy the generated source code and create a new file, or if it is generated, open the original file in a proper text editor and select ISO-8859-1 in the menu.

How many pages are affected by this issue?

5:35 am on Sept 4, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 4, 2004
posts:801
votes: 0


Just stop using notepad altogether, get a real text editor, delete that character, which shows up in most real text editors fine without changing anything.

popular ones I've seen mentioned here: textpad, crimson editor, editplus. There are many others, all probably decent. That character by the way will crash php pages if it's processing data before sending the header too.

There are no advantages to using notepad, or wordpad, that I am aware of, it's a bad product that does nothing well.

8:37 am on Sept 4, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 25, 2003
posts:2528
votes: 0


I didn't use notepad for this project. This is my first use of a wysiwyg editor. Up till now I have only used notepad and this has never happened. Is that the complete opposite of what you both are saying should happen?
9:17 am on Sept 4, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member kaled is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 2, 2003
posts:3710
votes: 0


The bottom line...

Do the affected pages contain this data when stored on your local PC, i.e. is your editor adding this junk or is it being added elsewhere? Since text editors/viewers are likely to lie about such things you may need a "hex viewer" to view these files (byte by byte).

Only when you locate the source of the problem can you hope to fix it.

Kaled.

11:48 am on Sept 4, 2005 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9074
votes: 6


Notepad is a common culprit for this problem, but not the only one. Basically, somewhere along the line your document has been saved as UTF-8 rather than ISO-8859-1.

I would dig around in your wysiwyg editor's menus to see what character encoding the program thinks that page is in. If it lists it as a UTF-8 file, try swapping that for ISO-8859-1 and resaving.