0

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')");
Priya
  • 165
  • 1
  • 12
  • possible duplicate of [UTF-8 all the way through](http://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – deceze Jan 25 '14 at 12:24

1 Answers1

1

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.

Axel Amthor
  • 10,980
  • 1
  • 25
  • 44
  • my connection is utf8 table is utf 8 while inserting i am telling it is utf8 what next????? still dsame insert – Priya Jan 25 '14 at 12:35
  • i added this on the top and hooooooooooooooooo its works thx mysqli_set_charset($link, 'utf8'); – Priya Jan 25 '14 at 12:41