Tuesday, 5 February 2013

Using other language pack in Zend Framework

Few Days ago I have used Turkish character in my database with using collate as utf8_turkish_ci.

Actual issue raises when we get the displaying the content of the table in browser. It showing good in phpmyadmin but not correct encoding in the browser.

For this I Put a code in the the models/dbTable


class Application_Model_DbTable_District extends Zend_Db_Table_Abstract {

protected $_name = 'district';

//Add this constructor to accommodate the turkish encoding correctly.
public function __construct($config = array())
{
parent::__construct($config);
$dbAdapter =$this->getAdapter();
$dbAdapter->query("SET NAMES 'utf8' COLLATE 'utf8_general_ci'");
$this->setDefaultAdapter($dbAdapter);
}

}

No comments :

Post a Comment