That advice on the Mysql Init Attribute is dangerous. Its not just adding this 
easily, because if the app is already in production and running on another 
charset you might break it.

On Saturday 11 April 2009 10:52:34 Stefan Gehrig wrote:
> Hi Andrei,
>
>
>
> please make sure that your data is UTF-8 encoded.
>
> Either run your retrieved data through utf8_encode() or make sure that the
> result returned from the database is UTF-8.
>
> When using MySQL (Zend_Db_Adapter_Pdo_Mysql) you can easily do this by
> adding a 'driver_options' key to your database configuration with
>
> 'driver_options' => array(
>
>     PDO::MYSQL_ATTR_INIT_COMMAND => “SET NAMES ‘utf8’”
>
> )
>
>
>
> Best regards
>
>
>
> Stefan
>
>
>
> Von: Andrei Iarus [mailto:poni1...@yahoo.com]
> Gesendet: Samstag, 11. April 2009 00:26
> An: Zend Framework
> Betreff: [fw-general] Zend JSON umlaut (special chars)
>
>
>
>
> Hello there,
>
>
>
> I have a problem with encoding an array retrieved from DB. I use this:
>
>
>
> $states = Zend_Registry::get('db')->fetchAll('SELECT state_id AS id,
> name_en AS name FROM core_states WHERE country_id = ?',
> $this->_getParam('countryId'));
>
> echo Zend_Json::encode($states);
>
>
>
> If the name_en field has an umlaut (from a german state), the encoding will
> return null. So
>
> [{"id":"124","name":null},{"id":"125",...]
>
> is an example (with only the first element), but when I var_dump the
> encoded var, I get
>
> array(16) {
>   [0]=>
>   array(2) {
>     ["id"]=>
>     string(3) "124"
>     ["name"]=>
>     string(17) "Baden-Württemberg"
>   }
> ...
>
>
>
> I see the last version (1.7.8). Did you encounter the same problem?
>
>
>
> Thank you

-- 
Benjamin Eberlei
http://www.beberlei.de

Reply via email to