Php has an automatic identification function mb_detect_encoding (), the following code detects the article encoding and automatically converts it to utf8 to automatically recognize the encoding and convert it to utf8 * ituibar.com * functioncharacet ($ data) {if (! Empty ($ data) {$ fileTypemb_detect_encoding ($ date
Php has an automatic identification function mb_detect_encoding (), the following code is the method for detecting Article encoding and automatically converting to utf8 // automatically recognizing the encoding and automatically converting to utf8/* Love push http://ituibar.com */function characet ($ data) {if (! Empty ($ data) {$ fileType = mb_detect_encoding ($ date
Php has an automatic identification function mb_detect_encoding (). The following code is used to detect the article encoding and convert it to utf8 automatically.
// Automatically recognize the encoding and convert it to utf8/* Love push http://ituibar.com */function characet ($ data) {if (! Empty ($ data) {$ fileType = mb_detect_encoding ($ date, array ('utf-8', 'gbk', 'latin1', 'big5 ')); if ($ fileType! = 'Utf-8') {$ data = mb_convert_encoding ($ data, 'utf-8', $ fileType) ;}} return $ date ;}
Original article address: the php function mb_detect_encoding automatically identifies the encoding and converts it to utf8. Thanks for sharing this with the original author.