Oh. I may be able to point you in the right direction here.
It seems as if the browser isn't correctly rendering the special characters. You may have to run your output through htmlentities(). However, this may not be the best solution, maybe someone else will have a better one.

Maxime P wrote:
No it's good, all is in utf-8. I become crazy, i don't understand my problem.
The only thing I know is the specials characters froml database appear as a
black square with a question mark.

Thanks for your help!
Jonathan Lebensold wrote:
hmmm... not sure... I would check the collation to make sure its utf8_unicode_ci and that the tables are InnoDB / utf8_general_ci... at least that's what I've used and its worked.

my 2 cents.

j

On 24-Aug-08, at 11:48 AM, Maxime P wrote:

Thank you Jonathan and no problem for your french.

You can answer me in english.

I've already done that but it don't works, i try everything.

I put:

In my bootstrap:
---------
try {
        $db = Zend_Db::factory($config->db);
        $db->query("SET NAMES 'utf8'");
        $db->internalEncoding = 'utf-8';
        $db->databaseEncoding = 'utf-8';
        Zend_Db_Table::setDefaultAdapter($db);
}

...

$view = new Zend_View(array('encoding'=>'UTF-8'));
---------


in my layout.phtml
<?php header('Content-type: text/html; charset=UTF-8'); ?>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"
/></head>


Only the data from the database appear with errors '?'. I don't understand
why? because the charset of the database is utf-8.


I think $db->query("SET NAMES 'utf8'"); don't work for all request.

Can you help me? Thks!






Jonathan Lebensold wrote:
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.


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




Reply via email to