views:

281

answers:

1

Hi again. I am using the next instructions to get some registers from my Database.

Create the needed models (from the params module):

$obj_paramtype_model    = new Params_Model_DbTable_Paramtype();
$obj_param_model        = new Params_Model_DbTable_Param();

Getting the available locales from the database

// This returns a Zend_Db_Table_Row_Abstract class object
$obj_paramtype = $obj_paramtype_model->getParamtypeByValue('available_locales');

// This is a query used to add conditions to the next sentence. This is executed from the Params_Model_DbTable_Param instance class, that depends from Params_Model_DbTable_Paramtype class (reference map and dependentTables arrays are fine in both classes)
$obj_select = $this->select()->where('deleted_at IS NULL')->order('name');

// Execute the next query, applying the select restrictions. This returns a Zend_Db_Table_Rowset_Abstract class object. This means "Find Params by Paramtype"
$obj_params_rowset = $obj_paramtype->findDependentRowset('Params_Model_DbTable_Param', 'Paramtype', $obj_paramtype);

// Here the firebug log displays the queries....
Zend_Registry::get('log')->debug($obj_params_rowset);

I have a profiler for all my DB executions from Zend. At this point the log and profiler objects (that includes Firebug writers), shows the executed SQL Queries, and the last line displays the resulting Zend_Db_Table_Rowset_Abstract class object. If I execute the SQL Queries in some MySQL Client, the results are as expected. But the Zend Firebug log writer displays as NULL the column values with latin characters (ñ).

In other words, the external SQL client shows es_CO | Español de Colombia and en_US | English of United States but the Query results from Zend displays (and returns) es_CO | null and en_US | English of United States.

I've deleted the ñ character from Español de Colombia and the query results are just fine in my Zend Log Firebug screen, and in the final Zend Form element.

The MySQL database, tables and columns are in UTF-8 - utf8_unicode_ci collation. All my zend framework pages are in UTF-8 charset. I'm using XAMPP 1.7.1 (PHP 5.2.9, Apache at port 90 and MySQL 5.1.33-community) running on Windows 7 Ultimate; Zend Framework 1.10.1.

I'm sorry if there is so much information, but I don't really know why could that happen, so I tryed to provide as much related information as I could to help to find some answer.

A: 

Hey David, how do you make the connection with the database and did you define the charset in that connection? That was something I overlooked and as I can't find it in your question that might be the problem? So, as I use the .ini file to setup the database, adding

resources.db.params.charset = utf8

Solved all my query UTF8 issues. Hope this helps.

Peter
I couldn't find any answer to this question soon, so I decided to use Doctrine as my Zend Framework DB ORM. But this answer looks fine. I'm going to create another project to test it, and I'll be back to comment a little bit more about your answer. If this solves that problem, I'll mark this answer as that. Thank you very much for your help, and have a nice day.
David Zapata