CodeIgniter Forums
$config['charset'] - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: $config['charset'] (/showthread.php?tid=3393)



$config['charset'] - El Forum - 09-27-2007

[eluser]cdmn[/eluser]
As we all know, CI v. 1.5.4 has a config value: $config['charset'] which is used in some string handling functions.

I would like to ask if this config value affects SET NAMES '{$config['charset']}'?

And are there any support for SET NAMES?


$config['charset'] - El Forum - 09-28-2007

[eluser]Référencement Google[/eluser]
It looks like not, I myself added a line in /system/database/DB.php at line 83 changed for:

Code:
$DB->query("SET NAMES 'utf8'");
return $DB;

Note that I blocked to UTF-8 since I use only this, it would be more smart to take the $config[’charset’] but I am too lazy to try doing it ;-)


$config['charset'] - El Forum - 09-29-2007

[eluser]cdmn[/eluser]
Lets hope next release will have something like this :-)

Thanks for your tip.


$config['charset'] - El Forum - 10-24-2007

[eluser]kylehase[/eluser]
[quote author="elitemedia" date="1191011815"]
Code:
$DB->query("SET NAMES 'utf8'");
return $DB;
[/quote]
FYI, this solution worked but produced an error in my log file.

Severity: Warning --> mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given /var/www/html/adminui/system/database/drivers/mysqli/mysqli_result.php 37

I'm now using the dummy library discussed here:http://ellislab.com/forums/viewthread/62139/


$config['charset'] - El Forum - 10-29-2007

[eluser]dyron[/eluser]
Hi,

my solution for this problem is to extend the database config file:

Code:
$db['default']['charset']  = "UTF8";

Because it's different to:

Code:
$config['charset'] = "utf-8";

And I also add

Code:
// Setting the charset        
    $DB->query("SET NAMES ?", $params['charset']);

to the "/system/database/DB.php" file. So it's not static UTF8.


$config['charset'] - El Forum - 12-18-2007

[eluser]czarft[/eluser]
Thank you.
I has include little condition.
Code:
if ( $params['charset']!="" )
    {
        $DB->query("SET NAMES ?", $params['charset']);
    }