• 0

[PHP] Mysterious Characters Appearing


Question

dev.dougmeagher.com

Does anyone else see those three characters above the first post? I don't know howwww to get rid of them, i've tried just about everything. I'm using PHP to pull those two entries from a MySQL database. If I take out the PHP and just toss some text in there, the characters go away. Here is the code i'm using...

<?php
if ( isset ( $_GET['page'] ) && $_GET['page'] !== '' )
{
	 $page = $_GET['page'] . '.php';

	 if ( file_exists ( $page ) )
	 {
		  include ( $page );
	 }
	 else
	 {
		  include ( 'home.php' );
	 }
}
else
{
	  include ( 'home.php' );
}
?>

Has anyone seen this kind of thing before?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

try removing each include one by one. if the include you remove also gets rid of the characters, then you'll have to skim through that corresponding page to find where the problem is. you can always post the respective page on here.

Link to comment
Share on other sites

  • 0

Eh, half way down you redeclare html and body. Also, make sure your mysql charset matches your html charset (ie make sure they are both utf8 or not utf8).

Link to comment
Share on other sites

  • 0

Eh, half way down you redeclare html and body. Also, make sure your mysql charset matches your html charset (ie make sure they are both utf8 or not utf8).

On the source code I have, I don't declare html and body again... but if I view page source, it appears. Weird

I also double checked the charset and switched it to utf-8, and that seems to have helped the problem, but i'm still questioning the mysterious html and body redeclaration

Link to comment
Share on other sites

  • 0

are using notepad or expression to code this?? then save your files with ANSI encoding not UTF encoding.

if you want UTF encoding than tell your editor to not put the unicode BOM (the three chars you see there) charactor in front.

the problem is php cant handle unicode BOM properly.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.