UTF8 and MySQL - weird characters

hello,

My MySQL charset is set to UTF8, stores the data correctly, even displays it nice on the screen, but when I export it to XLS or PDF I get weird characters back.

My question:

  • when I set the default charset in the main.php file
return array(


    ......


    'components'=>array(


        ......


        'db'=>array(


            'connectionString'=>'mysql:some_sql_stuff_here',


            'charset'=>'utf8',


        ),


    ),


    ......


);

is this equivalent to any of these options?

SET NAMES 'utf8'


SET CHARACTER SET utf8

if so, how can I set the other one? ;)

thanks,

–iM

It is equivalent to SET NAMES.

Setting character set:




Yii::app()->db->getPdoInstance()->prepare('SET CHARACTER SET ?')->execute(array('utf8'));

;)

thanks,

I’ve already tried that :( my ű and ő chars are still messed up. It is weird.

i

Do you wish to export with phpmyadmin or something else?

no, the users will have 3 options:

  • view the list on the screen (works fine)

  • export it to an XLS sheet (chars messed up)

  • export it to a PDF file (chars messed up)

I’m pretty sure it’s something with either the PHP or the MySQL settings. But have to find the right one, i guess :)

thanks though,

i