PHP - detecting the user supplied character's char set
问题 Is it possible to detect the user's string's char set? If not, how about the next question.. Are there reliable built-in PHP functions that can accurately tell if the user supplied string ( be it supplied thru get/post/cookie etc), are in a UTF-8 or not? In other words, can I do something like is_utf8($_GET['first_name']) Is there anyway this function could produce a TRUE where in reality the first_name was not in UTF-8? 回答1: Regarding 1: You can give mb_detect_encoding a try, but it's pretty