salut Maxime,

je m'excuse pour mon français briser...

il faut que tu ajustes le configuration de caractères avant que tu faits des transaction avec ton base de données.

Avec Zend_Db et MySQL, dans ton bootstrap.php ou n'importe quelle fichier qui comprend ton configuration de Zend_Db, il faut metre "SET NAMES 'utf8'" comme ça:

$db = Zend_Db::factory($config->db->adapter, $config_values);
// for Unicode support
$db->query("SET NAMES 'utf8'");
Zend_Db_Table::setDefaultAdapter($db);

bonne chance,

j




On 24-Aug-08, at 9:03 AM, Maxime P wrote:


Bonjour,

Mon problème se situe au niveau des données qui sont issues de la base de données et donc les caractères spéciaux s'affichent mal. Peux-tu me dire
comment tu as procédé?

Merci d'avance!

Cordialement,



quazardous wrote:

hi,

I m french and I want to use character encoding with zf...

So my question is : what's the good stategy between db/input/output
components ...

=> fot database it seams easy :

define an internal_encoding and a database_encoding ans subclass
Zend_Db_Adapter_Pdo_Mysql (ie for Mysql Pdo) :

----------
class Encoding_Db_Adapter_Pdo_Mysql extends Zend_Db_Adapter_Pdo_Mysql
{
protected $_internalEncoding;
protected $_databaseEncoding;
....
}
---------

overwrite query and fetch functions with mbstring stuff...

=> for inputs ust subclass zend_filter in the same way.j

=> but for outputs it's not so simple :

using mbstring.encoding_translation On is not very clean :
- side border effect on zf implementation (Zend_Cache uses ob_start)
- too much server side
...

I m thinking about using a Encoding_Dummy_Cache_Frontend_Page class... This class will just use ob_start with a mb_string callback function...

And subclassing Zend_Cache_Frontend_Page in Encoding_Cache_Frontend_Page
to overwrite the function _flush() with some mbstring stuff....


your advise ?







--
View this message in context: 
http://www.nabble.com/Charset-encoding-integration-stategy-in-ZF-%3A-how---tp13611650p19130455.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Reply via email to