Welcome Guest, Not a member yet? Register   Sign In
Unable to set client connection character set: utf8mb4
#1

I am creating a web app with ios developer, ios developer send text message with emoji and i store it on server db.
The emoji is not storing in table column someone told me change the column collation to utf8mb4_unicode_ci from utf8_unicode_ci and also change the application/config/database.php char_set to utf8mb4 and dbcollat to utf8mb4_unicode_ci but it gives me error on server on localhost it is working.

Please help thanks.
Reply
#2

Is the live server running the same version of MySQL that you are running on your localhost?
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(07-14-2016, 10:52 AM)InsiteFX Wrote: Is the live server running the same version of MySQL that you are running on your localhost?

Yes, actually i have two environment on server dev and live, both using same MySQL versions on dev utf8mb4 working but on live don't work.
And when i access the site on live server it show me the error [[/url][url=http://i.stack.imgur.com/nkM0p.png]snap shot], i am wonder why this is happening unable to find the main reason.
Reply
#4

Here is a stand alone script to test if the charset is being set or not will return the error if not set.

PHP Code:
<?php

// Set these for your server
define('db_user''');        // The database users name
define('db_password''');    // The database password
define('db_database''');    // The database name

$conn_id mysqli_connect('localhost'db_userdb_passworddb_database);

// check connection
if (mysqli_connect_errno()) {
 
   printf("Connect failed: %s\n"mysqli_connect_error());
 
   exit();
}

printf("Initial character set: %s\n"mysqli_character_set_name($conn_id));

// change character set to utf8mb4
if ( ! mysqli_set_charset($conn_id"utf8mb4"))
{
 
   printf("Error loading character set utf8mb4: %s\n"mysqli_error($conn_id));
 
   exit();
}
else
{
 
   printf("Current character set: %s\n"mysqli_character_set_name($conn_id));
}

mysqli_close($conn_id);

?>
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB