città !== città (What you see is not what you get) If your editor for example is latin1, you may have success when you do: $db_result_citta === utf8_encode("città");//result form db === your input Hope this helps, just a guess anyway. -Bart
Lossoth schreef:
Infact the problemi isn't in the browser, but in the PHP code: I've to compare an input string (ex: città) with values on my db I expect a match when encuonters the row containig "città" , but it doesn't happen because in the array (fetchAll()->toArray()) the string "città" si written in a wrong way... Bart McLeod wrote:Hi, If I use a utf-8 MySQL database and utf8 encoded output on website, I don't think I need to call SET NAMES explicitly, but I do not think it will harm if you do. But you should check if you output the result from the database in an utf8 environment, for example a web page that uses utf8 as the encoding type. Not sure if this will help. -Bart Lossoth schreef: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);
没有评论:
发表评论