I\'m trying to move some Excel-Data to MySQL, but having troubles with encoding.
What I did:
I've had a similar problem to this. Most things are set correctly "out of the box", but I'd just like to point out the following things I found useful... I hit this problem while moving from dev to live:
You need to have matching Database encoding (2 items to check) as well as view encoding.
The DB settings are, of course, set up in your database. In my case, using MySQL workbench, this was simply a case of right clicking the schema and selecting "Alter Schema...". From there I could select the encoding/collation I wanted.
In Cake PHP the database encoding is set in app\Config\database.php. You should ensure that the DATABASE_CONFIG array (approx line 60), has the correct encoding enabled/selected. For example:
'encoding' => 'utf8'
Finally, the view needs to select the correct version of HTML to display. This is written into your templates from the file app\Config\core.php (approx line 82).
Configure::write('App.encoding', 'UTF-8');
Once all three parts are changed, you should have a consistent charset and hence display.
Hope that helps any people still searching for this.
I had a similar symptom, my solution was to add
'encoding' => 'UTF8'
to config/database.php
Are you setting the connection to UTF-8 with mysql?
SET NAMES 'UTF-8'
$conn1 = mysqli_connect($this->db_host, $this->db_username, $this->db_password, $this->db_name);
Add this in connection
mysqli_set_charset($conn1,"utf8mb4");