Introduction: This is a detailed page of MySQL database encoding problem 3 (modifying the database, table, and field encoding to utf8). It introduces the related knowledge, skills, and experience of PHP, and some PHP source code.
Class = 'pingjiaf'
Black noodle
Yesterday I met a PHP website where the database was MYSQL5.1. After the phpmyadmin management of the website, I found that all Chinese characters in the table were garbled. After export, the local import was garbled, you cannot view
Open a Notepad under Windows and save the file with four encoding choices below. ANSI, which is the multibyte character set, is the char (char) string in VC. Unicode, which is UTF16, is the WCHAR (wchar_t) string in VC. Unicode big endian, is UTF32,
Linux under the UTF8 encoding batch conversion to GB2312 encoding method in Sqlplus import UTF8 encoded SQL script will appear garbled error, then need to convert UTF8 encoding GB2312 code, below for everyone to introduce under Linux how to
Problem Description: The project has been online for several months, has been running well, one day the system will not function properly, hibernate connection to the database problems; from the log see "cannot convert between UTF8 and UCS2: failutf8
There is a data table on the line, the character set is UTF8, but because of the reason of the environment is not unified, causes the data table to actually store the content is the latin1 inside code the data.In other words, the data of the latin1
The front-end time needs to convert utf8 and Unicode formats by yourself, and it is intended to encapsulate a class. I also thought about laziness. I tried to use it on the Internet, but later I found many problems. First, interfaces are different.
Because the database is not selected UTF8, so the default is Latin1On the internet to check a lot of information, tried a lot of methods, are not effective, a useful one should be a column of the change,Finally found this in the comments, holding a
This paper illustrates the method of PHP custom function to realize Chinese character conversion UTF8 encoding. Share to everyone for your reference, specific as follows:
The function is composed of two parts:
function Htou ($c) {
$n =
(1) Introduction of GB code(2) Encoding conversion(3) Time acquisition(4) Display toggleRecently made a character overlay, including time overlay, word character overlay, position movement, and other functions open. Because the general character is
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.