[Solar-talk] I18N question

Rodrigo Moraes rodrigo.moraes at gmail.com
Mon Jan 21 13:31:25 CST 2008


I have this code in an extended MySql adapter, to set the character
set right after connection. Don't know if it can be done in other way,
but here it is:

    /**
     *
     * User-defined configuration array. Keys are...
     *
     * 'charset':
     * (string) Character set definition.
     *
     * @var array
     *
     */
    protected $_Tipos_Sql_Adapter_Mysql = array(
        'charset' => 'utf8',
    );

    /**
     *
     * Creates a PDO object and connects to the database.
     * Set the character collation, if defined.
     *
     * @return void
     *
     */
    public function connect()
    {
        if ($this->_pdo) {
            return;
        }

        parent::connect();

        if ($this->_config['charset']) {
            $this->_pdo->exec('SET CHARACTER SET ' . $this->_config['charset']);
        }
    }


More information about the Solar-talk mailing list