Help Phpcms Bulk Extract content to description garbled

Source: Internet
Author: User
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.