Database transcoding solution

Source: Internet
Author: User
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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.