-
This problem is usually caused by inconsistent character sets. To solve this problem once and for all, do the following:
Set the encoding to UTF8
1.The encoding of the database.
When creating a database or table, specify the encoding to UTF8
2.The encoding of the web page is set to UTF-8 -- note that this is not UTF8 but UTF-8
3.After connecting to the database, add a mysql query() before executing anything else"set names utf8");
After this processing, you should be able to get the results you want.
-
First of all, when inserting Chinese characters into the database, the character set should be set to utf8.
Second, add the following statement after the php file link to the database.
mysql_query("set names gbk");
In this way, the inserted Chinese characters will not be displayed??? Finish.
-
You have two questions about this:
1- When Chinese is displayed?
This is an encoding issue with the display section, add a line before the display output.
echo header("content-type: text/html; charset=gb2312");
If not, check your database encoding and select utf82 when creating a table
Place this line of statement.
sql="select * from `jjga`.`humaninfo` where `username`=$name";
Instead. sql="select * from `jjga`.`humaninfo` where `username`='".$name."'";
This prevents syntax issues with SQL and is more secure.
-
Look at whether the code of the database is Chinese code, or change it to Chinese code.
-
The encoding of php and database should be consistent.
1.Modify the MySQL configuration file or, MySQL is best encoded in UTF8 [MySQL].
default-character-set=utf8[mysqld]
default-character-set=utf8default-storage-engine=myisam
default-collation=utf8_bininit_connect='set names utf8'
2.Add MySQL Query() before the php program that needs to do database operations"set names
Encoding'");If the PHP encoding is GB2312, then the MySQL encoding is GB2312, if it is UTF-8, then the MySQL encoding is UTF8, so that there will be no garbled characters when inserting or retrieving data.
-
mysql_query("set names 'utf'");Just put it in $conn and you're good to go.
-
Then you try utf8, I use utf8, you can store the man in the database.
-
It depends on the coding of the database.
-
PHP pages are UTF8, right? mysql_query("set name 'gbk' "There's something wrong with the way it was written, it should be.
mysql_query("set names 'gbk' "If it doesn't work, you can try to change it.
mysql_query("set names 'utf8' ")
-
You look at what the encoding of the web page you are displaying, as long as the encoding is consistent, there will be no garbled problem.
If you don't have a mysql field, you can try it with utf8 general ci.
-
Go to MySQL to set, don't set MySQL coding in PHP, garbled code must be a coding problem, it is recommended that you first change the coding of the table in MySQL, and then change the php encoding well, so that it should be no problem.
-
The field and table structure are encoded in UTF8 General CI.
-
Coding issues: The page encoding should be UTF8, live GBK, etc.
-
Codes are specified in both the entry and exit areas.
You didn't specify a good code.
-
In the database connection **Riga.
e.g. mysql connect($host, $user, $password);
mysql_query("set names gbk");
But the premise is that your database field finishing is also a GBK-related type, otherwise it will be even more messy, haha if it's a UTF8 mysql query("set names utf8");That's it.
-
Your file is not also saved in UTF-8 format.
-
Incorrect coding.
What is the encoding of the web page, if it is GB2312, in PHP, execute: MySQL Query("set names gb2312');
If you use utf-8, the set name utf8mysql field, the field involving text, also use the corresponding encoding to read the page with the corresponding encoding.
-
header("content-type:text/html;charset:utf-8")
Put before the echo output. Or put it on the first line of the program.
-
What format is chosen when the php file is saved. Select UTF8 to try when saving.
To ensure that Linux displays Chinese, you need to pay attention to the following two points: >>>More
Try to use "360 Security Guard" to repair the system first, and remember to reboot. >>>More
Theoretically, if the graphics card is broken, it will alarm the boot. >>>More
Looks like Intel's integrated graphics? graphics accelerator driver >>>More
It should have nothing to do with the climate, it is estimated that it should still be a problem with the program setting, is it unfamiliar or uncolored? The specific question depends on the specific situation.