CodeIgniter Forums
Inserting Special Characters Into Database - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Inserting Special Characters Into Database (/showthread.php?tid=36304)



Inserting Special Characters Into Database - El Forum - 11-27-2010

[eluser]asciiCode[/eluser]
I have the database set as utf-8 and the code igniter config set to utf-8

However, when I go to insert this example data in to the database "aaaaöbbbb"

The aaaa is added to the database but the öbbbb is left off and lost.

What am I doing wrong and how can I fix it?

Thanks.


Inserting Special Characters Into Database - El Forum - 11-27-2010

[eluser]InsiteFX[/eluser]
You need to create the database using collation utf8_unicode_ci

Also for phpMyAdmin
After creating the database click on the operations tab at the bottom
you can change the database to the utf8_unicode_ci

InsiteFX


Inserting Special Characters Into Database - El Forum - 11-27-2010

[eluser]asciiCode[/eluser]
Thank you for your reply, I am using utf8_unicode_ci


Inserting Special Characters Into Database - El Forum - 11-27-2010

[eluser]InsiteFX[/eluser]
You needto do the phpMyAdmin above!

Even if you create the database for utf8_unicode_ci it will default
right back to latin1_swedish_ci

click on the operations tab and look at the very bottom!

InsiteFX


Inserting Special Characters Into Database - El Forum - 11-28-2010

[eluser]asciiCode[/eluser]
Under the operations tab the collation value is and has been listed as utf8_unicode_ci. Also when I look at all of the rows and all of the tables the collation value is utf8_unicode_ci.


Inserting Special Characters Into Database - El Forum - 12-03-2010

[eluser]potatoDie[/eluser]
For me, changing the settings to utf8 of the database definition itself didn't work. But leaving the database collation at latin1_swedish_ci and using this also for the CI-settings (config/database.php) worked ok:

Code:
$db['default']['dbcollat'] = "latin1_swedish_ci";

I suppose any other latin would do, but not utf8?