Today, I encountered a problem. After several hours of finding an error, I was finally determined to be an Encoding Error. The original Encoding Error cannot be inserted into the database. The reason is that the data I collected is gb2312, and the database is utf8, so I have been wondering why the printed SQL statements are correct, but I cannot insert them into the database, if you run the SQL statement directly, it is successful. Finally, I was reminded by a brother that I realized that, because in my opinion, if the code is wrong, it should be wrong to execute the SQL statement, but I did not think of it, all fields in Chinese characters are canceled. This may be an experience issue. I don't think I will be able to touch it next time.
The page collected through gb2312 inserts utf8 data, stringMb_convert_encoding(String$ Str
, String$ To_encoding
[, Mixed$ From_encoding
]), Officially explained: Convert character encoding. The first parameter: the string you want to convert, the second parameter: Why is the conversion encoded (I am here utf8), and the third parameter: original code (here I am referring to the collection of the original page gb2312 ).
I only used this function today. I heard there are other string transcoding functions to be continued ....
Collection of string transcoding Problems