FirstOrderKylo FirstOrderKylo - 1 month ago 7x
HTML Question

How to remove  from a PHP page

I'm developing a small website and to include the header in using PHP's

function. However directly before any code brought in from the include, there's this weird  on the page.

Here's code for page where it's happening

<!DOCTYPE html>

<title>Things and Stuff | Source Files</title>
<!-- Style Sheets/Scripts/Misc Stuff -->
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/gmod.css">
<link rel="stylesheet" type="text/css" href="css/alerts.css">
<script src=""></script>
<script src="scripts/cycle.js"></script>


<?php include('./utilities/header.php'); ?>

<!-- rest of the page from here down... -->


I figured it out thanks to help from below.
To fix I opened the file in Notepad++, set it to PHP, and at the top under Encoding, selected ANSI (found that was = to UTF-8 w/o BOM) and it worked!


Your header file contains a Byte Order Mark header, not clearly visible be text editors which understand them and do not print them.

Compilers/parser, on the other hand, expect full ASCII, and don't understand BOM marks.

Solution: Remove the 3 first bytes of your header file with an hex editor or a text editor set to ASCII or UTF8 without BOM encoding and it will work.

below screenshot of the file encoded in UTF8 with BOM with 3 first chars highlighted (using frHed)

enter image description here

If I remove the 3 first bytes it works. OR: open with Notepad++ and change encoding to ASCII, save, voilà.