We often need to deal with character sets when database connections, especially when the data stored in the database contains non-ASCII characters, making sure the character set is set correctly. The mysqli::get_charset function is used to obtain the character set (charset) used by the current database connection. However, some developers find that the returned character set is always latin1 when using this function, even if they have set other character sets (such as UTF-8) when connecting to the database. So, why does this happen? What exactly went wrong?
mysqli::get_charset