I have a file test.php containing, this:
<HTML>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<?php include('text.html'); ?>
</body>
</html>
The included file contains a html formated text with various html tags. When executing test.php, the included text is displaid but the html tags are not formating the output but are visible like in a source.Also the utf-8 special characters are not displaid properly
Exemple: �h3> ( 1880, Bucure_ti - 1970, Bucure_ti )<�/h3> <�P>
If I do not use include but I am simply pasting the content of the included file directly into the source code, the output is fine. I also tried to use the below code I found on this site, instead of include, but the result was the same:
<?php
$f = fopen("bio.php", "r");
// Read line by line until end of file
while(!feof($f)) {
echo fgets($f) . "<br />";
}
fclose($f);
?>
What is wrong ?``
text.html
and/ortest.php
are/is not encoded inUTF-8
as your meta tag is claiming. Encode them both inUTF-8
. If you're still experiencing issues, encode themUTF-8 w/o BOM
. (Byte-Order Mark)