I didn't read carefully your email but I currently use UTF-8
encoding/charset on a web project with an oracle database. So, here is a
sample of my own code where APP_ENCODING = 'utf-8' and APP_DB = 'database'.
Hope you'll find your answer within it...


*config.ini*
[database]
database.adapter = Pdo_Oci
database.params.charset = utf8

*
Bootstrap*

//
// Database configuration
//
$config = new Zend_Config_Ini('config/config.ini', APP_DB);
$db = Zend_Db::factory($config->database);
[...]

//
// Zend Layout's MVC helpers
//
$headMeta = new Zend_View_Helper_HeadMeta();
$headMeta->appendHttpEquiv('Content-Type', 'text/html; '.APP_ENCODING)

//
// Controller init
//
$frontController = Zend_Controller_Front::getInstance();
[...]
$frontController->returnResponse(true);
try
{
    $response = $frontController->dispatch();
    $response->setHeader('Content-Type', 'text/html; charset='.APP_ENCODING,
true);
    $response->sendResponse();
}



On Mon, Apr 20, 2009 at 12:01 AM, James Carr <j...@purpleankh.com> wrote:
> 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.
>



-- 
Thomas VEQUAUD          http://thomas.vequaud.free.fr/
Expert EPITECH en Ingénierie Informatique
Tél : +33(0)6.50.39.28.10  Fax: +33(0)9.58.46.10.07

Reply via email to