EllisLab text mark
Advanced Search
     
Change database encoding
Posted: 23 October 2011 05:59 PM   [ Ignore ]
Avatar
Joined: 2010-11-22
188 posts

Does

mysql_query('SET NAMES `utf8`;'$link); 

is the same that

$db['default']['char_set''utf8'

OR

$db['default']['dbcollat''utf8_general_ci'

in “application\config\database.php” on Codeigniter? If not, how can I do it in Codeigniter?

 
Posted: 23 October 2011 07:23 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4405 posts

CI uses ‘char_set’ for SET NAMES and ‘dbcollat’ for COLLATE, unless your setup supports a specific method for setting the charset, in which case only ‘char_set’ is used.

For example, in case of MySQL, PHP >= 5.2.3 and MySQL >= 5.0.7:

mysql_set_charset($db['char_set']); 
 Signature 

Me: WanWizard.eu | My company: Exite | Datamapper: DataMapper ORM