M4Numbers M4Numbers - 7 months ago 16
HTML Question

How do I remove a \ufeff character in my webpage scripts?

I am trying to, simply put, remove a hidden zero-width-line-break character (U+FEFF) in my script. The webpage that it has appeared on is at http://cynicode.co.uk (Please note, the index page has been tinkered with and is the only one which functions properly at the moment)

By looking at the html elements on the page, this shows up:

enter image description here

The key point being the red dot between

< body >
< !--5-- >
. This, when hovered over, shows that it is a
character. The problem is that, when I look through the script, there is no such character that exists.

I am using PHP and HTML to construct this page, and the items between
< !--4-- >
< !--5-- >
consists of the following. Firstly, on the actual index page itself:

echo "<!--4-->";
echo "<head><meta charset='utf-8' /><link rel='shortcut icon' type='image/ico' href='./images/CyniCode.ico'>
<title>CyniCode :: Index</title>
<meta name='description' content='The Cynic's paradise! Home of Cynical.' />
<meta name='author' content='Cynical' />
<meta name='keywords' content='Cynical;Blog;Code' />
<link type='text/css' rel='stylesheet' href='./css/mystyle.css' />
<link rel='shortcut icon' type='image/ico' href='./images/CyniCode.ico'>
<link href='http://fonts.googleapis.com/css?family=Muli' rel='stylesheet' type='text/css' />
<script type='text/javascript' src='http://static.proofiction.net/jquery/jquery-1.9.1.min.js'></script>
<script type='text/javascript' src='http://static.proofiction.net/jquery/loginwait.js'></script>
<script type='text/javascript' src='http://static.proofiction.net/jquery/googleAnalytics.js'></script>
<script type='text/javascript' src='./http://static.proofiction.net/jquery/jquery.bxslider.js'></script>
<script type='text/javascript' src='./http://static.proofiction.net/jquery/jquery.bxslider.min.js'></script>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'><!--
google_ad_client = 'ca-pub-xxxxxxxxxxxx';
/* BiggerNavBox */
google_ad_slot = '3977705372';
google_ad_width = 300;
google_ad_height = 600;
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga('create', 'UA-xxxxxxxx-1', 'cynicode.co.uk');
ga('send', 'pageview');

require_once './functions/page.php';

This constitutes for the Index page. The page.php script referenced is my cheat for setting the page up quickly and cleanly. However... there is a small remaining difference between the two comments on the page. This is the remaining difference between the two comments.

echo "<!--5-->";

Any help that anyone can offer would be much appreciated. All code pieces were direct copy and pastes from my scripts.


Some of your .php files (probably ./functions/page.php contains Byte Order Mark. If you are using some IDE, check this file's encoding properties and with luck you will be able to remove it.

Edit If you use *nix, Elegant way to search for UTF-8 files with BOM? should help.