darkhorn Posted September 3, 2009 Share Posted September 3, 2009 I have created a class which is a web page temlate. All the files are utf-8 encoded. When I run the page it writes a unseen question mark at the very beggining of the page. Headers does not help. What I have to do to remove that question mark? Here is the main page: <?php header ('Content-type: text/html; charset=utf-8'); require ('template.php'); $homepage = new Page(); $homepage -> title="dsf"; $homepage -> keywords="dsf"; $homepage -> description="dsf"; $homepage -> content="dsf"; $homepage ->Display(); ?> And here is the class: <?php class Page { public $title; public $keywords; public $description; public $content; public $top_menu = array(bla bla bla); public $left_menu = array(bla bla bla); public function Display() { $this -> DisplayTypes(); $this -> DisplayDescription(); $this -> DisplayKeywords(); //bla bla bla $this -> DisplayFooter(); } public function DisplayTypes() { ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://bla bla bla The output in Firefox source view is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang bla bla bla In the Notepad++ is (copied from Firefox): ?<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang bla bla bla It is a problem while rendering the page (CSS). Quote Link to comment https://forums.phpfreaks.com/topic/172939-utf8-in-a-class/ Share on other sites More sharing options...
JonnoTheDev Posted September 3, 2009 Share Posted September 3, 2009 You must have saved the file with a unicode signature (BOM) in your text editor. Do not save your files with any unicode normalisation. Quote Link to comment https://forums.phpfreaks.com/topic/172939-utf8-in-a-class/#findComment-911478 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.