CodeIgniter Forums
CI 1.6 and MySQL 4.0 Character Set and Collation - 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: CI 1.6 and MySQL 4.0 Character Set and Collation (/showthread.php?tid=5803)

Pages: 1 2


CI 1.6 and MySQL 4.0 Character Set and Collation - El Forum - 02-13-2008

[eluser]James V[/eluser]
Thanks guys, this thread came in handy.


CI 1.6 and MySQL 4.0 Character Set and Collation - El Forum - 02-13-2008

[eluser]xwero[/eluser]
The solution works for lower mysql versions too. I tried it on a 3.23 version mysql.


CI 1.6 and MySQL 4.0 Character Set and Collation - El Forum - 02-13-2008

[eluser]tonanbarbarian[/eluser]
Is a posted in the bug forums i believe the better fix for this is the following

Code:
function db_set_charset($charset, $collation)
    {
        if ($charset===null || $collation===null) return TRUE;
        return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id);
    }

this checks to see if either the charset or collation is set to null, and if so do not try to set.
this is a better option i feel because it allows you to write an app that can work in either mysql 3+ or mysql 4.1+ just by setting the config options to null.

although this would be better served by a reworking of the DB_driver class so that the check for null values is done there and the db_set_charset method is just not called.


CI 1.6 and MySQL 4.0 Character Set and Collation - El Forum - 02-14-2008

[eluser]Derek Jones[/eluser]
Please see the aforementioned post as to why we are not taking approaches that allow circumvention of this setting, tonanbarbarian.


CI 1.6 and MySQL 4.0 Character Set and Collation - El Forum - 06-30-2008

[eluser]internut[/eluser]
doh! was hoping one of the suggested fixes would work. I'm not getting past the:

Unable to set client connection character set

error. doh!

MySQL Version: 4.0.27

Sad