These are the things I do to make sure I can work consistently with
UTF-8.

1) Make sure that the MySQL server and your database and all tables
within it are configured to store and output strings as UTF-8.

2) Make sure that the MySQL connection from CAKE is configured for
UTF-8 encoding. I do this in an overriden constructor in
app/app_model.php:

function __construct()
{
    parent::__construct();
    $this->execute("SET NAMES 'UTF8'");
 }

- I got this from an earlier discussion in this group I think. It made
the real difference for me.

3) Set the encoding for all your views as UTF-8 using the PHP header
command. At the moment I do this right at the top of my layouts - it
needs to go in somewhere before anything else is rendered:

<?php header("Content-type: text/html;charset=UTF-8"); ?>


4) Set the charset in HTML using the HTMLHelper although I don't think
this is so important:

<?php echo $html->charset('utf-8')?>

5) Make sure all your .php and .thtml files are UTF-8 encoded. Eclipse
and JEdit both do this fine and consistently.

- str_replace seems to work for me if I do all that (in PHP4) - I don't
use the multibyte functions.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to