Eugene Grosbein написал(а) к Victor Sudakov в Sep 17 15:03:46 по местному времени:
11 сент. 2017, понедельник, в 10:42 NOVT, Victor Sudakov написал(а):
VS> На тех сайтах, с которыми я сейчас разбираюсь, вебмастер широко использует
VS> функцию mysql
setcharset(), в каком-то таком виде
VS> if ($this->link = @mysql_connect($host, $user, $pass, 1)) {
VS> mysql
setcharset('cp1251', $this->link);
VS> ... }
VS> Видимо она и влияет на charset в handshake. Но какой выбирается charset, если
VS> эту функцию не использовать - я нигде даже нагуглить не смог.
https://dev.mysql.com/doc/refman/5.7...acter-set.html
27.8.7.67 mysql
set_characterset()
This function is used to set the default character set for the current
connection. The string csname specifies a valid character set name.
The connection collation becomes the default collation of the character set.
This function works like the SET NAMES statement, but also sets the value
of mysql->charset, and thus affects the character set used
by mysql
real_escapestring()
https://dev.mysql.com/doc/refman/5.7/en/set-names.html
SET NAMES {'charset
name' [COLLATE 'collationname'] | DEFAULT}
This statement sets the three session system variables character
setclient,
character
set_connection, and character_setresults to the given character set.
Setting character
set_connection to charsetname also sets
collation
connection to the default collation for charsetname.
See Section 10.1.4, Connection Character Sets and Collations.
Ну и далее
https://dev.mysql.com/doc/refman/5.7...onnection.html
Eugene
--- slrn/1.0.2 (FreeBSD)