recently i was working on my website and i was debugging with firefox and firefly.. as i looked at my HTML code, i saw that i had some weird characters on all my pages that were generated by PHP. always at the start of every page it had 


02-p8703-bom-encoding.gif

the code looked like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


i looked at my code and i didnt have any white spaces or anything. i read some posts that said samething about UTF-8 encoding.. recently i purchased a copy of dreamweaver. the new version has a settings for file encoding:

02-p8703-dreamweaver-encoding.gif

finally i figured it out whats been going on. its this thing call BOM. as you can see from my snapshot it says:

default encoding: Unicode(UTF-8)
[] use when opening existing files that don't specify an encoding

unicode normalization form: None
[] Include unicode signature (BOM)


thats what you need to do, i make sure Include unicode signature (BOM) is checked.

so now that i know what caused the problem, how do i fix it.

well i found a simple fix. there is a free application for windows called Notepad++. google it and download it.

once you have it installed on your computer, open your PHP file with notepad++ at the top, you will see a menu, select Encoding.you will see the encoding options:
02-p8703-notepad-encoding.gif

[x] Encode in ANSI
Encode in UTF-8 without BOM
Encode in UTF-8
Encode in UCS-2 Big Endian
Encode in UCS-2 Little Endian
Character sets
--------------------------------
Convert to ANSI
Convert to UTF-8 without BOM
Convert to UTF-8
Convert to UCS-2 Big Endian
Convert to UCS-2 Little Endian

Select 'Convert to UTF-8 without BOM' save the changes and reload your page where you are seeing the strange characters and you will not see them again.





how to get rid of  at the beginning of a file