Priya
Priya

Reputation: 165

chinese character in mysql insert and phpmyadmin

i have this chinese character which i want to insert into database and browser output in correct but when data is inserted into mysql it is in different format something like this.

my chinese characters

图片库,高清图片大全,图库

and inserted into database is

图片库,高清图片大全,图库

i have tried several things like setting utf8

     mysql_set_charset("utf8", $connection);

then chenaged the collation from swidish to utf general

then checked the details with this command which proved that my charcter is correctly set to utf8

   SHOW CREATE TABLE tablea;

   CREATE TABLE `tablea` (
   `id` int(12) NOT NULL AUTO_INCREMENT,
   `tiya` text CHARACTER SET utf8 NOT NULL,
   PRIMARY KEY (`id`),
  ) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

can anyone suggest where to solve chinese charracter issue .my insert is this

         mysqli_query ($con,"INSERT INTO tablea (tiya) VALUES ('$tit')");

Upvotes: 0

Views: 2982

Answers (1)

Axel Amthor
Axel Amthor

Reputation: 11096

All of your entire environment must be utf-8-capable. The file encoding of you php-file must be utf-8. The web server (apache?) must serve utf-8. Your mysql table must have utf-8 as charset. You connection(s) must be utf-8.

If one in the chain is missing, you get the above results. Additionaly: if you tried to fiddle around with character conversion inbetween, this is probably mixed up entirely. Once the above chain is set up properly, no char conversion is needed at all.

Upvotes: 1

Related Questions