Encode Problem

Hi guys!!

I have a app that accept two ways to insert an model into database (mysql), 1st way are by normal form and submit data and all goes right. 2st way is by import xls file, that contains the values to do insert, so i read the xls and set attributes models and make save/update, BUT when i make the insert/update on database, my encode data are lost, in any charcter i got "?" inteasd correct char.

So i check table database charset is LATIN1, my main.php contains:

  'db' => array(


      'connectionString' => 'mysql:host=localhost;dbname=myDataBase',


        'emulatePrepare' => true,


        'username' => 'root',


        'password' => '',


        'charset' => 'utf8',


        'enableProfiling' => YII_DEBUG,


        'enableParamLogging' => YII_DEBUG,


    ),

Im google about the problem and find people saying to change ‘charset’=>‘latin1’, but one question, if i change i must beware about loose my all data encode in all tables? because at moment the problem is specific to one table!!

I try to use utf8_decode, mb_convert_encode, chtml::enconde but nothing goes right =(

Someone can help me ?? Thanks

Hi Fernando

You should convert your database from Latin to utf8.

Make a backup of your database before you try, or make a new database test.

In my own databases I use always utf8_general_ci and I never have any problem :)

Hi,

same as KonApaz, allways going with utf8_general_ci[color="#1c2837"][size=3] for the DB and views files, and no troubles.[/size][/color]