CodeIgniter Forums
Problem adding polish letters into the 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: Problem adding polish letters into the database (/showthread.php?tid=41334)



Problem adding polish letters into the database - El Forum - 05-04-2011

[eluser]jacobson[/eluser]
Hello I have a problem with codeigniter and mysql database. I have my database set to utf8_general_ci, in the coonfig/database i have the same
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';

and still when I try to process the polish letter i get an error
http://screenshotuploader.com/s/CahgEhnYcz

where could be the problem ?


Problem adding polish letters into the database - El Forum - 05-05-2011

[eluser]eoinmcg[/eluser]
couple of things to check:
1. have you set Content-type to utf8 in the head of your html? (<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
)?
2. is your database / database tables using utf8 / utf8_general_ci’ ?

here's a handy guide to what you should be doing:
http://philsturgeon.co.uk/blog/2009/08/UTF-8-support-for-CodeIgniter


Problem adding polish letters into the database - El Forum - 05-05-2011

[eluser]Unknown[/eluser]
Show us some code (html headers, controller and model).

You can write a PM to me, I'll try to help you in polishWink


Problem adding polish letters into the database - El Forum - 05-05-2011

[eluser]Ken Verhaegen[/eluser]
Validate the input with htmlspecialchars (special chars become &charname; in the database) or something before you add the text into the database.
You'll now have decent encoding to send to your database Wink
Grts.