Encoding cannot be converted. PHPcodevar_dump ($ message); $ charset = mb_detect_encoding ($ message); $ message = iconv ('utf-8', 'gbk // IGNORE ', $ message); // $ the encoding cannot be converted. thank you!
PHP code
var_dump($message);$charset = mb_detect_encoding($message);$message = iconv('UTF-8','GBK//IGNORE',$message);//$message = mb_convert_encoding($message, 'GBK', 'UTF-8');$charset2 = mb_detect_encoding($message);var_dump($charset,$charset2,$message);
Output:
String 'commandid commandid policytest_0 commandid when there were too many commandid? Why? 20120717-1504-6317 ?? ?? Why? Too many? 78.000 seconds later than just a few seconds later than before running the program $4001156677 seconds later than 159 '(length =)
String 'utf-8' (length = 5)
String 'utf-8' (length = 5)
String 'commandid commandid policytest_0 commandid when there were too many commandid? Why? 20120717-1504-6317 ?? ?? Why? Too many? 78.000 seconds later than just a few seconds later than before running the program $4001156677 seconds later than 159 '(length =)
Changing the file encoding is also UTF-8
Anyone? Online
------ Solution --------------------
Try to add
Header ("Content-Type: text/html; charset = utf-8 ");
------ Solution --------------------
Error_reporting (E_ALL );
Header ("Content-Type: text/html; charset = utf-8 ");
Is it UTF8 without BOM?
The BOM may be invalid because the header is invalid.