MyBB Community Forums

Full Version: UTF-8 Encoding
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have this:
<?php
if(THIS_SCRIPT == 'index.php'){
	session_start();
}
chdir('foros');
define("IN_MYBB", 1);
$filename = substr($_SERVER['SCRIPT_NAME'], -strpos(strrev($_SERVER['SCRIPT_NAME']), "/"));
define('THIS_SCRIPT', $filename);
require_once './global.php';
eval("\$welcomeblock1 = \"".$templates->get("welcomeblock")."\";");
header('Content-Type: text/html; charset=utf-8');
echo"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="es" lang="es" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>

But accents and all that kind of words appear as "�".

This was the templat I was using before this:
<?php
session_start();
chdir('foros');
define("IN_MYBB", 1);
require './global.php';
eval("\$welcomeblock1 = \"".$templates->get("welcomeblock")."\";");
header('Content-Type: text/html; charset=utf-8');
echo"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>

I don't know what the problem is :-\
Firstyl, you need to replace this:
header('Content-Type: text/html; charset=utf-8');
echo"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
with this:
header('Content-Type: text/html; charset=utf-8');
echo"<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

See if that makes any difference Smile
(2011-10-24, 12:27 PM)Tom K. Wrote: [ -> ]Firstyl, you need to replace this:
header('Content-Type: text/html; charset=utf-8');
echo"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
with this:
header('Content-Type: text/html; charset=utf-8');
echo"<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

See if that makes any difference Smile

Wait, what did you exactly change there ?
^ may be this :
The semicolon signifies the end of a PHP statement and should never be forgotten
(2011-10-24, 02:56 PM)Ansem Wrote: [ -> ]
(2011-10-24, 12:27 PM)Tom K. Wrote: [ -> ]Firstyl, you need to replace this:
header('Content-Type: text/html; charset=utf-8');
echo"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
with this:
header('Content-Type: text/html; charset=utf-8');
echo"<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

See if that makes any difference Smile

Wait, what did you exactly change there ?

Added the semicolon to the end of that statement Wink
Did it work?
Thanks Tom (I thought the last semicolon could be forgotten), but didn't worked Undecided
http://pokecosmo.com.ar/index.php
Try changing it to this:
header('Content-Type: text/html; charset=UTF-8');
echo'<?xml version="1.0" encoding="UTF-8"?>'; 
@ Tom K.
Ah yeah, I didn't see it then, was quite hard to spot for me.
The reason I can't really progress in PHP, I always overlook those symbols.
It looks to be a theme problem, since the only 2 places I could find with the error were in the menus. Even then, in the forums part it gets it right. You might try re-saving the templates for that index page after fixing the errors. It should just be the tabs at the top and the site menu on the side that need fixing.

Also, your site is very slow for me.
Tanks again Tom for trying, but it doesn't work Undecided

The weird thing is that it works in my old index page :|
http://pokecosmo.com.ar/index1591.php
Pages: 1 2