View Full Version : PHP character encoding issues

11-10-2007, 12:29 AM
OK, I have this site (http://ich-gestehe.de/gestaendnis/comments/index) where some umlauts arenít displayed correctly. Specifically those that arenít directly written in the default HTML template but included through include files (Cake PHPís THTML files in this case). I can encode some of the text with HTML entities but only the ones that are directly written in the HTML, not the ones that are written through PHP.


<?php echo $html->link(/*$comment['User']['username'].*/'Kommentar zum Gestšndnis machen', '/messages/add/'.$comment['Comment']['user_id'].'/'.$comment['Comment']['id']); ?>
<?php if($session->read('user.admin') == '1') { ?>
<a href="<?php echo $html->url('/admin/comments/delete/'. $comment['Comment']['id']); ?>">[L&ouml;schen</a>

The Ų in the word ďLŲschenĒ in the anchor (last line in example) would be displayed as ď√∂Ē if I put it literally but I can encode it as &ouml; (however, Iíd rather write it out literally). However, the š in the word ďGestšndnisĒ is echoed through PHP and I canít put an HTML entity there because it would output it literally (as &auml;). Iíve come as far as figuring out that it must be the encoding of that THTML file (or the way PHP outputs characters) as plain HTML in the master template will be output correctly if I change the headerís charset.

Unfortunately Iím not advanced enough in PHP to figure it out myself so how do I set/change the character encoding PHP is outputting? Or specifically how can I make it so I get proper characters from the PHP output rather than ď√§Ē (thatís the output from the character ďšĒ) etc.?

11-12-2007, 12:53 PM
Iím sad to see that nobody is respondingÖ :( What else do you need from me, guys?

11-12-2007, 01:05 PM
Anything to do with meta charset?

11-12-2007, 02:18 PM
No, itís not the meta charset in the HTML header. If I set that to UTF-8 the plain HTML umlauts are displayed wrong as well but if I set it to ISO-8859-1 they are alright. This has nothing to do with the HTML charset, itís definitely the PHP character encoding since itís only the characters that come from a PHP echo. That must be set from UTF-8 to ISO-8859-1, too, but I donít know how and where. Any suggestions?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum