debussy007 wrote:
No one has any idea on how I couold even debug this ?
Thank you for any help ...
debussy007 wrote:
Hi,
When I try to fetch data with special characters from the DB and try to
log it, strange characters will appear instead of the correct one.
For example:
$this->logger->debug($event->nom); // Nâdiya
echo $event->nom; // Nâdiya
if I put the value manually :
$this->logger->debug('Nâdiya'); // Nâdiya
echo $event->nom; // Nâdiya
All my tables and fields rom MySQL are encoded in "utf8_general_ci"
When I initialize the DB connection, I always set the connection in UTF8
also :
$dbAdapter->query("SET NAMES 'utf8'");
The .phtml file is also ecoded in UTF8 without BOM
What am I missing ?
Thank you for any kind help.
I'm not sure if it will fix your problem, but I had a case where I was
calling
htmlentities( $text )
in my code and I had to change it to
htmlentities( $text , ENT_COMPAT , 'UTF-8' )
To quote the PHP manpage - http://php.net/htmlentities
Like htmlspecialchars(), it takes an optional third argument charset
which defines character set used in conversion. Presently, the
ISO-8859-1 character set is used as the default.
htmlentities counterpart html_entity_decode also takes a char-set parameter.
I'm guessing that there is a charset problem happening somewhere in your
code.
James.