Welcome Guest, Not a member yet? Register   Sign In
Character encoding, CodeIgniter and MySQL
#1

[eluser]Gaz[/eluser]
Hi all,

Just wondering if anybody can help me out with a character encoding problem with MySQL and CI.

Basically I'm importing data from an Excel spreadsheet into MySQL. The spreadsheet gets converted to an array, and some of the fields have foreign-language accented characters, such as é and å.

These characters display fine when I output them to the browser from the array, but when they get inserted into the database they appear as '?'.

The variables returned from the query "show variables like 'character%'" come back as

Code:
character_set_client        utf8
character_set_connection    utf8
character_set_database        utf8
character_set_filesystem    binary
character_set_results        utf8
character_set_server        utf8
character_set_system        utf8
character_sets_dir        /usr/share/mysql/charsets/

I'm using

Code:
header("Content-Type: text/html; charset=utf-8");

on every view, and the database.php config file includes the lines

Code:
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";

The results from

Code:
$this->db->last_query();

also show the characters as '?', although they are fine before the query.

Cheers,
Gaz.


Messages In This Thread
Character encoding, CodeIgniter and MySQL - by El Forum - 07-14-2009, 09:15 AM
Character encoding, CodeIgniter and MySQL - by El Forum - 07-14-2009, 09:41 AM
Character encoding, CodeIgniter and MySQL - by El Forum - 07-14-2009, 10:12 AM
Character encoding, CodeIgniter and MySQL - by El Forum - 07-14-2009, 11:00 AM
Character encoding, CodeIgniter and MySQL - by El Forum - 07-14-2009, 11:30 AM
Character encoding, CodeIgniter and MySQL - by El Forum - 07-26-2009, 03:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB