Welcome Guest, Not a member yet? Register   Sign In
Problem get data in MySQL 5.5 with table in UTF8mb4
#1

[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
#2

[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.
#3

[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!!
#4

[eluser]InsiteFX[/eluser]
Or do it in a MY_Controller




Theme © iAndrew 2016 - Forum software by © MyBB