How to deal with mysqgbk writing and UTF-8 extraction
Source: Internet
Author: User
Mysqgbk write, UTF-8 extract my mysql database and edit it as UTF-8, the data in it is written using gbk .. Because gbk is usually set during extraction, although the database contains garbled characters, the extraction is normal... The data must be extracted in the UTF-8 environment .. Ask the gods how to deal with mysq gbk writing, UTF-8 extraction
My mysql database is edited as UTF-8, and the data in it is written in gbk .. Because gbk is usually set during extraction, although the database contains garbled characters, the extraction is normal... The data must be extracted in the UTF-8 environment .. What can I do if I can display it normally ????
Not to blame ..
------ Solution --------------------
In principle, gbk is used to convert the image to UTF-8. Test is required.
It is best to achieve unification.
------ Solution --------------------
"Set names utf8" can be properly displayed in the UTF-8 environment before data query.
------ Solution --------------------
Mysql_query ('Ste names utf8 ');
------ Solution --------------------
Mysql_query ('Ste names utf8 ');
Set encoding
------ Solution --------------------
Iconv
------ Solution --------------------
The field type is utf8?
Have you used set names gbk before?
Use length (...) to test the length of Chinese characters. if it is normal, use set name utf8.
Otherwise, after the export is used, change the encoding at the beginning of the file and then import it.
Discussion
My mysql database is edited as UTF-8, and the data in it is written in gbk .. Because gbk is usually set during extraction, although the database contains garbled characters, the extraction is normal... The data must be extracted in the UTF-8 environment .. What can I do if I can display it normally ????
Not to blame ..
------ Solution --------------------
Discussion
The problem is solved .. A little strange .. The iconv function cannot be used to extract and display data from set names UTF-8 during extraction .. Thank you very much.
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