Problem get data in MySQL 5.5 with table in UTF8mb4 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Problem get data in MySQL 5.5 with table in UTF8mb4 (/showthread.php?tid=60367) |
Problem get data in MySQL 5.5 with table in UTF8mb4 - El Forum - 03-09-2014 [eluser]Unknown[/eluser] Hi, I have a problem. In a database have register with emojis. The emoji is save like ut8mb4 encoding. When i write the field, it shows like interrogant (?) If i do a Php file without CI, and i print the field its correct. I tried to change the file database.php with the fields char_set and dbcollat but not works. Anyone can help me? please. Thanks you Problem get data in MySQL 5.5 with table in UTF8mb4 - El Forum - 03-10-2014 [eluser]InsiteFX[/eluser] You should be using a COLLATION of utf8_unicode_ci or utf8_general_ci - CI doe's not understand the ut8mb4 encoding. Problem get data in MySQL 5.5 with table in UTF8mb4 - El Forum - 03-11-2014 [eluser]Unknown[/eluser] Thank you! I found the solution but I need to do it better. The solution is before to execute the query put: Code: $this->db->query('SET NAMES ut8mb4'); It works, but i need to for all application. I'm thinking to create a hooks. What you think? Many thanks!! Problem get data in MySQL 5.5 with table in UTF8mb4 - El Forum - 03-11-2014 [eluser]InsiteFX[/eluser] Or do it in a MY_Controller |