2009年1月22日星期四

[fw-db] Encoding problems

Hello,

I'm developing a web-app using PostgreSQL and Zend_Db.
The database is encoded in UTF8.
If in a field I've a character with accent (like: à ò è ù), in the DB it is
show correctly.
A fetcAll() on this table returns the characters with accent on a wrong way.
My problem is wery similar to this thread "How to specify Charset with
PDO/MySQL":
http://www.nabble.com/How-to-specify-Charset-with-PDO-MySQL-tt7438169.html

I've try the solution suggested in the thread but the problem persist.

Someone can help me?

My code:

class Fx_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Pgsql {
protected function _connect() {
if ($this->_connection)
return;

parent::_connect();

$this->query("SET NAMES 'UTF8'");
}
}


$db = new Fx_Db_Adapter_Pdo_Pgsql(array(
'host' => 'localhost',
'username' => '******',
'password' => '******',
'dbname' => 'dbname'
));

Zend_Db_Table_Abstract::setDefaultAdapter($db);

--
View this message in context: http://www.nabble.com/Encoding-problems-tp21607648p21607648.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: