attributeLabels charset ???

i have same model SeachAd with CListView atributeLabes not encoded utf , the problem is in sitecontroller i have





and when i call in layout CMENU

array('label'=>'Apartments', 'url'=>array('items/apartments'),'linkOptions'=>array('class'=>'midle')

i click the Apartments link render ItemController which have apartments action

public function actionApartments(){


$dataProvider=new CActiveDataProvider('SeachAd',array( 'criteria'=>array(



                        ),        ));




thats work to,

then view renders

$this->widget('zii.widgets.CListView', array(











in model SeachAd atribte labels have special characters , š ,ž ,

public function attributeLabels(){

              return array(

'name' =>'Naslov',

              	'tribalstate' =>'Odaberite županiju',

              	'location'=>'Odaberite mjesto',

              	'zip'=>'Poštanski Broj',




te widget view order by have Odaberite �upaniju ,

encoding bug

Yep its bug,

ClistView calls CSort function resolveLabel()

public function resolveLabel($attribute)






            return $definition['label'];


    else if(is_string($definition))



        return CActiveRecord::model($this->modelClass)->getAttributeLabel($attribute);


        return $attribute;


wich calls

getAttributeLabel(), and returns $labels[$attribute]; i try to encode it returning string charset wich is not utf8 nothing hapend, nothing happend when i try encode and decode with htmlentities ( );

Solution Found, in sortableAttributes set labels directly,




'mjesto'=>'Odaberite mjesto',

'pobroj'=>'Poštanski broj',


If you use this solution below will be bagged(If your language has it) special characters,







this is not good described on yii class reference



 foreach($this->sortableAttributes as $name=>$label)


echo "<li>";


echo $sort->link($label);


echo $sort->link($name,$label);

echo "</li>\n";


I think that the problem is that the model is not encoded in utf8.

Change the encode of the model to utf-8 without BOM and all will be fine.

Thanks, zaccaria model was windows-1521, not utf8, works now on both way


To solve problem with encoding was the job of the first days of work in russia… what a bad weeks I had!