Later, I found the is_utf8 function in the manual. In this way, combined with the iconv function, my problem was solved. This function is posted below:
Copy code The code is as follows:
function is_utf8($string) {
return preg_match('%^(?:
[x09x0Ax0Dx20-x7E] # ASCII
| [xC2-xDF][x80-xBF] # non-overlong 2-byte
| xE0[xA0-xBF ][x80-xBF] # excluding overlongs
| [xE1-xECxEExEF][x80-xBF]{2} # straight 3-byte
| xED[x80-x9F][x80-xBF] # excluding surrogates
| x80-x8F][x80-xBF]{2} # plane 16
)*$%xs', $string);
} // function is_utf8
if If you want to study in depth, it is recommended to read the "Multibyte String Functions" section of the PHP manual.
http://www.bkjia.com/PHPjc/319973.html
www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319973.htmlTechArticleLater I found the is_utf8 function in the manual. In this way, combined with the iconv function, my problem was solved. This function is posted below: Copy code The code is as follows: function is_utf8($str...