Easyeclipseforphp is used for programming PHP garbled code. the default encoding is gbk, which can display Chinese characters. There are a lot of written classes on the Internet, take it directly, found that are UTF-8 encoding, the entire program encoding method into the UTF-8, the class of the man part in eclipse can be shown, but garbled characters are displayed in the browser. how can this encoding problem be solved? is there any good solution or suggestion. When the database is added, PHP garbled code may occur.
Program with easyeclipse for php. the default encoding is gbk, which can display Chinese characters.
There are a lot of written classes on the Internet, directly take it to use, found that are UTF-8 encoding, the entire program encoding method changed to UTF-8, class man part in
It can be displayed in eclipse, but it is still garbled in the browser. how can this encoding problem be solved? is there a good solution or suggestion. With the database, garbled code is more likely.
------ Solution --------------------
Change the browser encoding to UTF-8. To save the trouble of modifying the browser encoding every time. Add header ("Content-Type: text/html; charset = utf-8") at the beginning of the row ");
If data is involved. The database encoding is also utf8.
------ Solution --------------------
We recommend that you use UTF-8 for future development. in the future, if you have the opportunity to go to linux or put files on a linux host, it will be much less troublesome.
Especially when it comes to data transmission such as json ajax.
I have suffered from this pain point and began to use gbk. later, I found that many places should consider encoding.