Reputation: 4187
I'm using a UTF8_unicode database that I was using previously with a home-made code. So the database is perfectly fine, I can fetch my data and display it without problems.
I'm trying to switch to CodeIgniter. I've changed database.php and config.php to make it display UTF8 BUT it just doesn't work. I have to use utf8_decode inside of my controllers if I want to be able to display my data correctly. Any idea why? It's driving me insane right now.
Upvotes: 0
Views: 4443
Reputation: 11
After spending lots of time, I got solution of this problem.
1) Open your PHPMyAdmin database.
2) Select your database.
3) After select your table.
4) Goto structure then clicks on change which column you want to store that type of data.
5) goto Collation and change the type from latin1_swedish_ci to utf8_general_ci.
This logic corrected my data
Upvotes: 1
Reputation: 4187
After browsing the web a lot I've found my solution!
CodeIgniter uses mysql_query("SET NAMES utf8")
to communicate with the mysql server. So if you've never used this before it mess everything. I don't know how I'm going to deal with it.
I also did :
ALTER TABLE p1x3l_posts MODIFY texte TEXT character set latin1;
ALTER TABLE p1x3l_posts MODIFY texte BLOB;
ALTER TABLE p1x3l_posts MODIFY texte TEXT character set utf8;
and it corrected my data.
Upvotes: 0