homepage Welcome to WebmasterWorld Guest from 184.73.52.98
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
How to get rid of these characters: 
Shows on web page after replacing an include
jastra




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

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" />
<![endif]-->

 

jastra




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

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

mbabuskov




msg:4295110
 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.

tangor




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

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

jastra




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

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.

SteveWh




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

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.

mbabuskov




msg:4296818
 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.

tangor




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

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...

mbabuskov




msg:4297159
 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.

jastra




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

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.

looter




msg:4301648
 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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved