It seems to be common knowledge to use mysql_set_charset / mysqli::set_charset instead of the direct MySQL query set names.
The reason often cited is that se
SET NAMES ... is a convenience alias:
A
SET NAMES 'charset_name'statement is equivalent to these three statements:SET character_set_client = charset_name; SET character_set_results = charset_name; SET character_set_connection = charset_name;Setting character_set_connection to charset_name also implicitly sets collation_connection to the default collation for
charset_name.
... that provides MySQL Server with all the text-encoding information required for current connection. So far so good.
But PHP is also involved and it will not learn anything from here because it's basically a random user query. There are two things that PHP will not do for obvious performance reasons:
In short: this method notifies the server but not the client. However, dedicated PHP functions do both things.