Pike v8.0 release 1738

Method Sql.mysql()->get_charset()


Method get_charset

string get_charset()

Description

Returns the MySQL name for the current connection charset.

Returns "unicode" if unicode encode mode is enabled and UTF-8 is used on the server side (i.e. in character_set_connection).

Note

In servers with full charset support (i.e. MySQL 4.1.0 or later), this corresponds to the MySQL system variable character_set_client (with one exception - see next note) and thus controls the charset in which queries are sent. The charset used for text strings in results might be something else (and typically is if unicode decode mode is enabled; see set_unicode_decode_mode).

Note

If the returned charset is latin1 or unicode and unicode encode mode is enabled (the default) then character_set_client in the server might be either latin1 or utf8, depending on the last sent query. See set_unicode_encode_mode for more info.

See also

set_charset