Yii Framework Forum: Encode Problem - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Encode Problem Help me understand it Rate Topic: -----

#1 User is offline   Fernando Trindade 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 23-October 12

Posted 23 October 2012 - 02:03 PM

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
0

#2 User is offline   KonApaz 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,327
  • Joined: 21-February 11
  • Location:Greece

Posted 23 November 2012 - 09:08 AM

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 :)
Yii is the best php framework in the world!
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

#3 User is offline   AndreiCurelaru 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 11-November 12
  • Location:France

Posted 23 November 2012 - 01:14 PM

Hi,

same as KonApaz, allways going with utf8_general_ci for the DB and views files, and no troubles.
Les Tags pour organiser le Forum FrenchYii : LINK
@AndreiCurelaru
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users