MYSQ GBK Write, Utf-8 extract, how to handle

Source: Internet
Author: User
MYSQ GBK Write, Utf-8 extract
My MySQL database is edited as Utf-8, and the data in it is written in GBK. Because the usual extraction is also set GBK, so although the database is garbled, but the extraction is normal ... This data must now be extracted in a utf-8 environment. Ask the great God, how to deal with the normal display????
Do not blame the few points.

------Solution--------------------
According to reason, take the GBK display to turn into utf-8. Specifically, it has to be tested.
It's better to be unified.
------Solution--------------------
"Set names UTF8" before querying data to display normally in utf-8 environment
------Solution--------------------
mysql_query (' Ste names UTF8 ');

------Solution--------------------
mysql_query (' Ste names UTF8 ');
Set encoding
------Solution--------------------
Iconv
------Solution--------------------
is the field type UTF8?
Have you used set names GBK before?
Use Length (...) Measure the length of Chinese characters, if normal, use set name UTF8
Otherwise, export the encoding at the beginning of the file and then import


discuss
My MySQL database is edited as Utf-8, and the data in it is written in GBK. Because the usual extraction is also set GBK, so although the database is garbled, but the extraction is normal ... This data must now be extracted in a utf-8 environment. Ask the great God, how to deal with the normal display????
Do not blame the few points.

------Solution--------------------
discuss

The problem is solved. It's weird. Extraction can not be used when the set names Utf-8 extracted to display the time with the ICONV function processing. Thank you very much, everybody split
  • Related Article

    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.