Today, when I used php to read csv files with Chinese characters in Linux, the Chinese characters were not displayed, and I felt that the Chinese language was discriminated against. later I found that I had to add the Chinese language logo. When PHP reads a csv file in the LIUNX environment, the Chinese characters in the csv file are not displayed... today, when I used php to read csv files with Chinese characters in Linux, the Chinese characters were not displayed, and I felt that the Chinese language was discriminated against. later I found that I had to add the Chinese language logo.
When PHP reads a csv file in the LIUNX environment, Chinese characters in the csv file are not displayed ....
Finally, I found a solution. let's share it with you!
Add the following sentence before reading the csv file:
Setlocale (LC_ALL, 'zh _ cn ');
Instantly solved the problem ....
Instance:
Note:
// UTF-8
Setlocale (LC_ALL, 'en _ US.UTF-8 ');
// Simplified
Setlocale (LC_ALL, 'zh _ cn ');
Extended knowledge:
The following are common region identifiers:
Zh_CN GB2312
En_US.UTF-8 UTF-8
Zh_TW BIG5
Zh_HK BIG5-HKSCS
Zh_TW.EUC-TW EUC-TW
Zh_TW.UTF-8 UTF-8
Zh_HK.UTF-8 UTF-8
Zh_CN.GBK GBK
Article link:
Save this article for favorites!