PHP page when using UTF-8 Chinese characters all garbled when using GB2312 show normal, but to the database is inserted is empty, when using UTF-8 can insert Chinese characters, but the page is garbled, for help
Reply to discussion (solution)
The page number encoding is inconsistent with the database encoding.
The page number encoding is inconsistent with the database encoding.
The page cannot be displayed after UTF-8 encoding is modified.
Try saving the webpage in the format of utf8 with bom. can you see it?
Try saving the webpage in the format of utf8 with bom. can you see it?
What should I do? I use editplus.
FILE --> Save As-select "encoding"
It is not a good habit to use bom. check whether the file encoding is uniform.
Set names utf8 is not executed during insertion;
FILE --> Save As-select "encoding"
Okay. I'll try it back.
Set names utf8 is not executed during insertion;
What do you mean?
Execute SQL INSERT with mysql_query ("set names utf8"); tell mysql to use utf8 encoding for execution.
The premise is that the browser encoding and table encoding will not be garbled when both UTF-8 is used.
It was originally the content of gbk. it must be declared as UTF-8, so it is strange that it is not garbled.