ZF-3204: Mysqli dB adapter ignores utf8 connection charset


I have used Zend_dB_Adapter_Mysqli to connect to a MySQL server 5.0.51a. All tables have uftf8 charset for their columns. UTF8 data entered in forms is saved correctly to the dB. When reading records from the database, only ascii characters were read normaly. It is also impossible (or I don't know how) to set the correct charset through adapter options. My workaround was to create my adapter as follows:

require_once 'Zend/Db/Adapter/Mysqli.php';

class MyMysqliDbAdapter extends Zend_Db_Adapter_Mysqli {
    protected function _connect() {
            if ($this->_connection) {
        $this->_connection -> set_charset('utf8');

This issue need at least to be documented. A good solution would be to add + document the corresponding option for the adapter.


No comments to display