When phppreg_match_all is used to process Chinese characters, garbled characters are modified to UTF-8, but some matching results may contain garbled characters such as php preg_match_all.
The encoding is changed to UTF-8, but some matching results may contain garbled characters.
Reply content:
Php preg_match_all garbled characters when processing Chinese characters
The encoding is changed to UTF-8, but some matching results may contain garbled characters.
To support I18N, we recommend that you use mb_ereg _ * series functions. For more information, see Manual in PHP.
When we capture a remote webpage, garbled code may occur due to encoding problems and transcoding is required.
$ File = file_get_contents ("http://blog.xbmu.info"); // remotely capture preg_match_all (); // extract information // select transcoding as needed: $ str2 = iconv ("UTF-8 ", "gb2312 // IGNORE", $ str2); // Convert utf to gb2312 $ str2 = iconv ("gb2312", "UTF-8 // IGNORE", $ str2 ); // Convert gb2312 to utf