Php reads Chinese characters from text files and inserts them into the database. Chinese characters are garbled.-tutorial

Source: Internet
Author: User
Php reads Chinese characters in the text file and inserts them into the database. Chinese characters are garbled.-ask me to read Chinese characters from the text file and insert them into the MYSQL database. in phpmyadmin, check that this field is garbled, very depressing... my text files are UTF-8 encoded, php files, databases, and data tables are all UTF-8 encoded. I really don't know where the problem is. Have you ever encountered such problems? I am very grateful to php for reading Chinese characters in text files and inserting them into the database. Chinese characters are garbled.-tutorial
I read Chinese characters from a text file and inserted them into the MYSQL database. in phpmyadmin, I checked the field as garbled and it was very depressing... my text files are UTF-8 encoded, php files, databases, and data tables are all UTF-8 encoded. I really don't know where the problem is. Have you ever encountered such problems?
Thank you!

------ Solution --------------------
Conn. php is posted. why? Account hiding


It is possible that the set names 'utf8'; or equivalent function statement is not executed.
------ Solution --------------------
1. You seem to have missed a picture: the garbled figure in phpmyadmin
2. unless you use show variables like 'character \ _ set \ _ % 'to view utf8
Otherwise, set names utf8 cannot be less


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.