Pike v8.1 release 6

Method Sql.mysql()->set_unicode_decode_mode()


Method set_unicode_decode_mode

void set_unicode_decode_mode(int enable)

Description

Enable or disable unicode decode mode.

In this mode, if the server supports UTF-8 then non-binary text strings in results are automatically decoded to (possibly wide) unicode strings. Not enabled by default.

The statement "SET character_set_results = utf8" is sent to the server to enable the mode. When the mode is disabled, "SET character_set_results = xxx" is sent, where xxx is the connection charset that get_charset returns.

Parameter enable

Nonzero enables this feature, zero disables it.

Throws

Throws an exception if the server doesn't support this, i.e. if the statement above fails. The MySQL system variable character_set_results was added in MySQL 4.1.1.

An error is also thrown if Pike has been compiled with a MySQL client library older than 4.1.0, which lack the necessary support for this.

See also

set_unicode_encode_mode