In my database config file, I have:
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
...and in config.php I have:
$config['charset'] = "UTF-8";
I am trying to store the following string to a mySQL table, using an Ajax call:
Academia-Gate — the Nanny State & The Professors: My Brief Email Exchange With The Co-Chair of the “Cry Wolf” Project
The string arrives at my php Ajax handler function looking like this:
Academia-Gate — the Nanny State & The Professors: My Brief Email Exchange With The Co-Chair of the “Cry Wolf” Project
When I try to store it to my mySQL table, the string is stored like this:
Academia-Gate ??” the Nanny State & The Professors: My Brief Email Exchange With The Co-Chair of the “Cry Wolf” Project
I.e. with ??” in place of the long dash near the beginning.
I have tracked this down to something that happens during the function escape_str, in DB_driver.php. The escape_str function utilizes a call to mysql_real_escape_string.
The following code:
$str = 'Academia-Gate — the Nanny State & The Professors: My Brief Email Exchange With The Co-Chair of the “Cry Wolf” Project ';
$str = mysql_real_escape_string($str, $this->conn_id);
...changes the contents of $str to:
Academia-Gate ‚Ä\" the Nanny State & The Professors: My Brief Email Exchange With The Co-Chair of the ‚ÄúCry Wolf‚Äù Project
I.e. it replaces >>>‚Äî<<< with >>>‚Ä\”<<<, so that it is then stored incorrectly in the mySQL table.
How can I correct this?
Thanks very much in advance to all for any info.