Concerning the problem of importing txt files into the database encoding, we need to import the txt files to the database. due to the encoding, some data fails to be written. after I add the following code, all the data can be imported, but it's all ????? Mysql_query (& quot; setnamesGBK & quot ;); could you tell me how to convert the txt file content to the uft-8 encoding I use the following code does not seem to work mb_convert_encoding ($ about the txt file import database encoding problem
Currently, the txt file is imported to the database. some data fails to be written due to encoding.
After I add the following code, all the data can be imported, but all of them are ????? No.
Mysql_query ("set names 'gbk '");
Could you tell me how to convert the txt file content into uft-8 encoding
The following code does not seem to work.
Mb_convert_encoding ($ u [11], 'utf-8', 'ascii, GB2312, gbk, UTF-8 ');
------ Solution --------------------
$ Txt = mb_check_encoding ($ s, 'utf-8 ')? $ Txt: mb_convert_encoding ($ s, 'utf-8', 'gbk ');