Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.