1

I have this code :

<?php    require_once('config.php'); ?>

<!DOCTYPE html>
<html>
<head>
 <meta charset='utf-8'> 
 <title>test</title>
 <meta name="description" content="test" />
</head>
<body>
    <span>test</span>
</body> 
</html>

And config.php is simply

<?php

?>

Both files are encoded in utf-8 (meaning, in Notepad++, I chose "Encoding in UTF-8")

Now on Chrome, it seems that the page is not being rendered correctly. When I inspect the page, my code looks like :

enter image description here

As you see meta and title tags are going inside body element and I have double quotes... I have been turning this over and over and I don't know why.

If I change the encoding of config.php to ANSI with Notepad++, it works.

But I want all my files to be in UTF-8...

Mansur Khan
  • 1,675
  • 1
  • 12
  • 24
  • where did the `style` element came from. you have to be looking at the wrong source or destination. – DevZer0 Jul 10 '13 at 08:46
  • It seems it has also been automatically created. However , by the way, when I display the source code, using Ctr+U. Eveythings is at the right place. It is just on inspection. – Mansur Khan Jul 10 '13 at 08:49
  • Another answer suggests leaving out something called the "byte order mark", and make sure your server is handing the files with UTF-8 character encoding declared in the response header. http://stackoverflow.com/questions/4696499/meta-charset-utf-8-vs-meta-http-equiv-content-type – user2867288 May 02 '15 at 16:30

2 Answers2

1

It seems to work when I use "Encoding in UTF-8 without BOM" in Notepad++. I will go with this then.

Mansur Khan
  • 1,675
  • 1
  • 12
  • 24
0

Have you tried to remove the white spaces before ?