Mysql_query (& quot; SETNAMESutf8 & quot;); is not executed when writing data to the database before database transcoding. as a result, Chinese characters in my database are garbled and browsing can be properly displayed, is there a way to convert garbled characters in the database to utf8? ------ Solution -------------------- read data in one way (without setnames). If you need it, transcode the data to the most database.
I did not execute mysql_query ("SET NAMES utf8") when writing data to the database. as a result, Chinese characters in my database are garbled and browsing can be properly displayed, is there a way to convert garbled characters in the database to utf8?
------ Solution --------------------
Read data in one way (without set names). if necessary, transcode the data and store the data in another way (with set names ).
------ Solution --------------------
Utf is required for the character set of the library/table.
Next, let's take a look at it. if it doesn't work, use a program to insert it and create a new database.
------ Solution --------------------
Http://www.discuz.net/forum.php? Mod = viewthread & tid = 650717.
Http://www.baidu.com? Wd = mysql + % CA % FD % BE % DD % BF % E2 % D7 % AA % C2 % EB & rsv_bp = 0 & rsv_spt = 3 & inputT = 9929
------ Solution --------------------
Use the php function iconv ("gb2312", "UTF-8", $ str) to convert the string when outputting data.
------ Solution --------------------
Export the database to the. SQL file, and then rewrite it with iconv ("gb2312", "UTF-8", $ str) to import the new. SQL generated. can you?