PHP Phpcms truncation garbled
PHPCMS Official forum popularity is not high, special help csdn of the great gods. The following code is intended to bulk extract content from the content table into the Description field, and filter the characters and intercept the word count.
But after running the file, the database Description field is all? The code is as follows:
0xa0? $H _start+1: $H _start), for ($i = $H _start; $i < $H _str_len; $i + +) {if ($i >= ($H _start+ $H _len)) break; $H _size = Ord (Sub STR ($H _str, $i, 1)) > 0xa0? 3:1; $H _tmep. = substr ($H _str, $i, $H _size); $i + = $H _size > 1? 1:0;} if ($H _flag = = "Y" && $H _start+ $H _len < $H _str_len) | | $H _flag = "YY") {$H _tmep.= "...";} return $H _TMEP;} function H_preg_repe ($H _str) {$H _searh = array ("' Si '," ' <[\/\!] *? [^<>]*?> ' si ', ' ' ([\ r \ n]) [\s]+ ' "," ' & (quot| #34); ' I "," ' & (amp| #38); ' I "," ' & (lt| #60); ' I "," ' & (gt| #62); ' I "," ' & (nbsp| #160); ' I "," ' & (iexcl| #161); ' I "," ' & (cent| #162); ' I "," ' & (pound| #163); ' I "," ' & (copy| #169); ' I "," ' "(\d+); E "); $H _reple = Array ("", "", "\\1", "\" "," & "," < "," > ", "", Chr (161), Chr (162), Chr (163), Chr (169) , "Chr (\\1)"), Return Trim (Addslashes (NL2BR (Stripslashes (Preg_replace ($H _searh, $H _reple, $H _str))));} echo "Batch add summary success";? >
Reply to discussion (solution)
$H _char = ' utf-8 '; This is wrong, the MySQL developer initially wrote the code in the omission of a "-", causing the problem continues to today
$H _char = ' UTF8 ';
MySQL in Utf-8 need to write UTF8