The public has encountered garbled Chinese characters during development. This issue was found to be a coding problem. In fact, you only need to convert the code into utf8 to solve it. let's take a look at it for details. Many public platforms use ThinkWechat for automatic reply. class. php... the public has encountered garbled Chinese characters during development. This issue was found to be a coding problem. In fact, you only need to convert the code into utf8 to solve it. let's take a look at it for details.
Many automatic reply programs on the public platform are developed based on ThinkWechat. class. php. today, I encountered an inexplicable garbled problem. I found it was caused by GB2312 encoding, so I had to modify the source code.
Add a method first
/*** Check whether the UTF-8 * @ param $ str * @ return bool */private function is_utf8 ($ str) {return preg_match ('// U', $ str );}
Find
$ This-> data ['content'] = $ Content;
Change
If ($ this-> is_utf8 ($ content) {$ this-> data ['content'] = $ Content ;} else {$ this-> data ['content'] = iconv ('gb2312', 'utf-8 // IGNORE ', $ Content );}
You can.
Article URL:
Reprint ^ at will, but please attach the tutorial address.