Jump to content

utf8 in a class


darkhorn

Recommended Posts

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).

Link to comment
https://forums.phpfreaks.com/topic/172939-utf8-in-a-class/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.