I am importing data from outside into my database MYSQL using PHP Scripts. Encoding my database charset to utf8 from the query
ALTER DATABASE DEFAULT CHARSET 'utf8';
then i executed a query to see all charsets by
SHOW VARIABLES LIKE 'character_set%';
output is:
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
as we can see character_set_database
is set to utf8
but still if i write a code from my PHP Script to see the encoding as
echo $charset = mysql_client_encoding($cn);
the output is latin1
. From the above query latin1 is for server only. Can anyone tell me what exactly i am missing as i am unable to encode my Chinese and Japaneses characters to database.
EDIT
I am importing a database from outside which have unicode characters as 我的上网主页 and 嶏紞鎴戠殑 in Chinese , Japaneses and other different languages. But when i import data to my database tables i get ????? instead of above characters. How can i encode these characters? Is it utf-8 or 16 and how i can recognize that which encoding will support these characters?