This article describes several solutions to PHP garbled text. PHP garbled Problem 1. how does PHP handle uploaded CSV files? You can use the fgetcsv function: -- read a row from the file pointer and parse the CSV field, but he cannot process the Chinese characters.
PHP garbled Problem 1. how does PHP handle uploaded CSV files?
You can use the fgetcsv function: -- read a row from the file pointer and parse the CSV field, but he cannot process the Chinese characters in it. Therefore, after uploading, convert the csv to the encoding;
PHP garbled problem 2. encoding conversion;
- iconv("GB2312","UTF-8
//IGNORE",file_get_contents($uploadfile));
Ignore indicates ignoring errors during conversion, but using another function seems better than mb_convert_encoding;
PHP garbled problem 3. Jmail may also cause garbled characters when sending emails:
If the webpage is UTF-8 encoded, you CAN $ jmail-> charset = 'utf8 ';
However, most of the inbox is GB2312. you can use mb_convert_encoding to convert the positive file;
- $ Zhengwen = 'only good mothers in the world ';
- $ Jmail-> Body = mb_convert _
Encoding ($ zhennwen, 'gb2312', 'utf-8 ');
We hope that this article will help you solve the three PHP garbled problem handling skills.
Prepare how to process uploaded CSV files? You can use the fgetcsv function: -- read a row from the file pointer and parse the CSV field, but he cannot process the Chinese characters in it...