>
> Or is there a better way that it will always get used automatically
> with any layout ?
>   
I think the layout *is* the appropriate place to do this as one may have 
layouts with different encodings. However, if you want to define a 
'default' encoding for all layouts (which you can then overwrite in them 
with another call to header()), I would put it in 
AppController::beforeRender() or beforeFilter (the latter might be a 
better place if you need the encoding to work with debug() calls inside 
your actions).

HTH,
-- Felix
--------------------------
My Blog: http://www.thinkingphp.org
My Business: http://www.fg-webdesign.de


Mech7 wrote:
> Ok so in my layouts i would have to have:
>
> <?php
> header('Content-Type: text/html; charset=utf-8');
> ?>
>
> Or is there a better way that it will always get used automatically
> with any layout ?
>
> On Sep 1, 2:58 pm, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
>   
>> You should also send a HTTP header indicating your content is served as
>> UTF-8. I think IE needs that under circumstances.
>>
>> -- Felix
>> --------------------------
>> My Blog:http://www.thinkingphp.org
>> My Business:http://www.fg-webdesign.de
>>
>> MrG wrote:
>>     
>>> I solved my problems with UTF-8 by using this alter command after the
>>> creation of my database:
>>>       
>>> ALTER DATABASE
>>>    CHARACTER SET utf8
>>>    DEFAULT CHARACTER SET utf8
>>>    COLLATE utf8_general_ci
>>>    DEFAULT COLLATE utf8_general_ci
>>>    ;
>>>       
>>> And in cakephp database configuration:
>>>       
>>>    var $default = array('driver' => 'mysql',
>>>                                                            'connect' => 
>>> 'mysql_connect',
>>>                                                            'host' => 'host',
>>>                                                            'login' => 
>>> 'login',
>>>                                                            'password' => 
>>> 'password',
>>>                                                            'database' => 
>>> 'database',
>>>                                                            'prefix' => '',
>>>                                                            'encoding' => 
>>> 'UTF8');
>>>       
>>> No need to change core classes.
>>>       
>>> Oh.. and every editor I use for working with php and ctp files are
>>> using UTF-8 encoding too. And on the top of every web page I have
>>> also:
>>> <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
>>>       
>>> Regards
>>>       
>>> Gonçalo Afonso
>>>       
>>> On Aug 31, 6:03 pm, Mech7 <[EMAIL PROTECTED]> wrote:
>>>       
>>>> Thanks this works great with me in 1.2 :) would be nice if this was
>>>> added in database.default.php or atleast in the comments.
>>>>         
>>>> On Aug 31, 6:44 pm, djiize <[EMAIL PROTECTED]> wrote:
>>>>         
>>>>> if you have Cake 1.2, add 'encoding' => 'utf8' in conf/database.php
>>>>> if you have Cake 1.1, call query("SET NAME 'UTF8' ") just after
>>>>> connexion (don't remember if in database.php or app_model.php)
>>>>>           
>>>>> On 31 août, 18:36, Mech7 <[EMAIL PROTECTED]> wrote:
>>>>>           
>>>>>> Ah that is great google can't handle them either :D here is what it
>>>>>> looks with me:
>>>>>>             
>>>>>> http://img124.imageshack.us/img124/2272/characterhellko6.gif
>>>>>>             
>>>>>> On Aug 31, 6:30 pm, Mech7 <[EMAIL PROTECTED]> wrote:
>>>>>>             
>>>>>>> Does anybody know how to save utf8 charachters properly in Cake.. when
>>>>>>> i save special characters they get saved very weird in mysql for
>>>>>>> exmaple: ????  becomes öööö
>>>>>>>               
>>>>>>> The database table is set to utf8_general_ci and in the html it is set
>>>>>>> to utf8 too.. <meta http-equiv="Content-Type" content="text/html;
>>>>>>> charset=utf-8" />
>>>>>>>               
>>>>>>> The problem seems to come when saving to mysql, does anybody know how
>>>>>>> i can fix this ?
>>>>>>>               
>
>
> >
>
>   

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to