Issue information

Issue ID
#5154
Status
Needs more Info
Severity
None
Started
Hercules Elf Bot
Dec 23, 2011 6:35
Last Post
mkbu95
Jun 9, 2013 6:41
Confirmation
N/A

Hercules Elf Bot - Dec 23, 2011 6:35

Originally posted by [b]Tiera[/b]
[color=#008000]More efficiently be replaced by [u]'self && mysql_set_character_set &self-> handle, encoding) == 0[/u]' for '[u]self && Sql_Query (self, "set names% s", encoding) == SQL_SUCCESS[/u]' at function [u]Sql_SetEncoding[/u], it would save users from problems with different encoding, for example, MySQL database to UTF-8 encoding but server cp1251 (Russian-language example of the server).[/color]

Hercules Elf Bot - Dec 26, 2011 10:28

Originally posted by [b]Ind[/b]
i will flag as confirmed so other devs may see, I don't really know what to do about this case.

mkbu95 - Jun 9, 2013 6:41

[code=auto:0]SET NAMES %s[/code]:[quote]
NAMES {'charset_name' [COLLATE 'collation_name'] | DEFAULT}

SET NAMES sets the three session system variables character_set_client, character_set_connection, and character_set_results to the given character set. Setting character_set_connection to charset_name also sets collation_connection to the default collation for charset_name. The optional COLLATE clause may be used to specify a collation explicitly. See Section 10.1.4, “Connection Character Sets and Collations”.

The default mapping can be restored by using a value of DEFAULT. The default depends on the server configuration.

ucs2, utf16, and utf32 cannot be used as a client character set, which means that they do not work for SET NAMES.[/quote][code=auto:0]mysql_set_character_set(&self->handle, encoding)[/code]:[quote]
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_escape_string()[/quote]Don't see any reason to change that.