PDA

View Full Version : UTF-8 Parse Fix


tomyeah
03-30-2007, 07:59 AM
i came upon a problem with my pixelpost charset. i'm a german and most of the special characters (Umlaute) were not rendered in the correct charset. even though the html had the utf-8 statement in the header my browser always autoselected a different charset. ive been testing this in IE, FF and Safari.

of course there is the following statement in all the template files:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

this is just not enough ... the image_template for example is included too late into the index.php when parsing the contents.

i made up an easy solution which worked in all my browsers.

open up the index.php and insert in the very beginning the following statement:



...
error_reporting(0);
ini_set('arg_separator.output', '&amp;');
session_start();

$PHP_SELF = "index.php";

header('Content-Type: text/html; charset=utf-8');

// includes
require("includes/pixelpost.php");
require("includes/markdown.php");
require("includes/functions.php");
require("includes/exifer1_5/exif.php");
...



this really fixed the problems on my side. all my browsers do autoselect the UTF-8 now instead of ISO-something. on some websites it says that this bug happens a lot when including templates into the web applications and the charsets are transfered too late to the browser.

regards, tom.

Dennis
03-30-2007, 02:18 PM
Fix incorporated in 1.6 final. Thanks for reporting!