How do I prevent encoding of dropdown list items

I have added a dropdown list for a couple of the columns in my CGridView on the admin page…




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

	'id'=>'plan-grid',

	'dataProvider'=>$model->search(),

	'filter'=>$model,

	'columns'=>array(

		array(

			'name'=>'name',

			'filter' => CHtml::listData(Plan::model()->findAll($criteria), 'name', 'name'),

			'value'=>'$data->name',

		),

		array(

			'name'=>'style',

			'type'=>'raw',

			'filter' => CHtml::listData(PlanStyle::model()->findAll(), 'description', 'description'),

			'value'=>'$data->style->description',

		),

		'beds',

		'baths',

		array(

			'name'=>'squareFootage',

			'value'=>'Yii::app()->NumberFormatter->format("#,##0 sq. ft.", $data->squareFootage)',

		),

		array(

			'name'=>'deleted',

			'value'=>'$data->getStatus($data->deleted)',

			'cssClassExpression' => "active",

		),

		array(

			'class'=>'CButtonColumn',

			'header'=>'Operations',

			'buttons'=>

				array('delete'=>

					array('label'=>'Activate/Deactivate',

					),

				),

			'deleteConfirmation'=>false,

		),

	),



This works fine except that several of the items in the ‘style’ column are stored in the database with the ½ HTML character entity and when displayed in the dropdown menu, the & of ½ is encoded.

This means the HTML that is generated is


<option value="1&amp;frac12; Story">1&amp;frac12; Story</option>



instead of


<option value="1&frac12; Story">1&frac12; Story</option>



The values of that grid column display correctly because I use ‘type’=>‘raw’ to prevent encoding




		array(

			'name'=>'style',

			'type'=>'raw',

			'filter' => CHtml::listData(PlanStyle::model()->findAll(), 'description', 'description'),

			'value'=>'$data->style->description',

		),




Is there something similar I can do with CHtml::listData()?

Thanks

Try such code:




array(

	'name' => 'style',

	'type' => 'raw',

	'filter' => CHtml::activeDropDownList($model, 'style', CHtml::listData(PlanStyle::model()->findAll(), 'description', 'description'), array('id' => false, 'prompt' => '', 'encode' => false)),

	'value' => '$data->style->description',

),



That worked! Thanks!

Update: Well, it sort of works. It does prevent the encoding, but if I choose the drop down option with the special character, it doesn’t find any results. It works fine with any of the other options in the drop down list.

Update #2: I took the easy way out and solved the problem by using ½ instead of &frac12; in the database and now it works fine. Thanks for your help.