Hello. I am having an annoying problem with php function require(). First of all, look at the files (All utf-8 encoded).
index.php
body.phpCode:<?php
echo '
<html>
<head>
<meta http-equiv="Content-Language" content="en"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>require() test</title>
</head>
<body>';
require ("body.php");
echo '
</body>
</html>';
?>
The problem is, that including something from another file using require() or include() generates unwanted symbol "". You probably do not see it, but copy and paste it to Notepad or smth and you will see.Code:<?php
echo '
<p>Test...</p>
<hr>
<table border="0" width="100%">
<tr align="left" width="100%">
There is a <b>""</b> symbol at the end of <b>body</b> tag. But why?
</tr>
</table>
<hr>
<br>';
?>
Here is the the result:
If I am just eching the code in the same index.php, everything is fine.HTML Code:<html> <head> <meta http-equiv="Content-Language" content="en"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>require() test</title> </head> <body> <p>Test...</p> <hr> <table border="0" width="100%"> <tr align="left" width="100%"> There is a <b>""</b> symbol at the end of <b>body</b> tag. But why? </tr> </table> <hr> <br> </body> </html>
Any suggestion how to fix this (remove that symbol).
P.S. require() or include() must be there.
I just tested it and I see no symbol. require() test
It could be your server admin playing games or something.
Maybe you are right. Check this: tmatematikas(dot)mikrovisata(dot)net/test/.
Oh, I forget to say, wamp gives the same.
And more: it is no matter what the encoding of index.php is. I found, that ONLY the file's, which is included, encoding makes sence. If body.php is utf-8 - the symbol appears, if ansi - no symbol. Strange thing.
Jordan, make sure body.php is utf-8.
Here it is.
I see nothing
I suspect the symbol is an artifact of Notepad, and not a character being sent.
Are you blind (thank's God WingedPanther sees it)?Then make a simple Webpage with echoing <!DOCTYPE... and other stuff in a way I have mentioned and try to validate it. As I did. W3C says it is that character in prolog and it is not alowed. Try to validate my homepage (remove /test/), which address is seen in the picture. How would you explain that?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks