CakePHP scaffold & UTF8

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

CakePHP scaffold & UTF8

Jerry-2

Hello Bakers:

I found something interesting in CakePHP. It's about utf8.

Some bakers suggest below approach that makes utf8 works in CakePHP.

class AppModel extends Model{
  function __construct($id=false, $table=null, $ds=null){
    parent::__construct();
    $this->query("SET NAMES 'utf8'");
  }
}

It does work. The UTF8 characters can be displayed correctly.
In my apps using scaffold, Index can list the DB tables correctly.
But when I click Edit (or View) into the item, nothing can be
displayed.

Everything is shown, but every column data is empty.

Does anybody have such experience?

Jerry
--
http://www.fonsen.com.tw/


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

Reply | Threaded
Open this post in threaded view
|

Re: CakePHP scaffold & UTF8

Eric-131

I think the problems is the Mysql not Cake.
Cause I faced it.
Try to set your MySQL charset:  UTF-8 Unicode (utf8)
and MySQL connection collation utf-8_unicode_ci.



Jerry wrote:

> Hello Bakers:
>
> I found something interesting in CakePHP. It's about utf8.
>
> Some bakers suggest below approach that makes utf8 works in CakePHP.
>
> class AppModel extends Model{
>   function __construct($id=false, $table=null, $ds=null){
>     parent::__construct();
>     $this->query("SET NAMES 'utf8'");
>   }
> }
>
> It does work. The UTF8 characters can be displayed correctly.
> In my apps using scaffold, Index can list the DB tables correctly.
> But when I click Edit (or View) into the item, nothing can be
> displayed.
>
> Everything is shown, but every column data is empty.
>
> Does anybody have such experience?
>
> Jerry
> --
> http://www.fonsen.com.tw/


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

Reply | Threaded
Open this post in threaded view
|

Re: CakePHP scaffold & UTF8

Jerry-2
In reply to this post by Jerry-2

So far the best solution I found is :

http://groups.google.com/group/cake-php/browse_thread/thread/902d931ff87eb8ac/c4ca2c14891df179#c4ca2c14891df179


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