Html Entities For Yii Form


I want to know is there any configuration for encoding html entities in Yii before saving the model. So that before saving model all the entities are html encoded automatically and I dont need to do them for all the model where I am taking data from users.


It’s somewhat unusual to HTML encode data before storing it in the database. It makes more sense to keep the data unaltered in the data store and HTML encode it just before outputting it.


use this in your main.php configuration ‘charset’=>‘utf-8’, in db configuration

Okay.fair enough.

So, is there any switch or attribute in CActiveForm so, it automatically HTML encode all form data.Or is there any other central position so i can encode them before display.??

Figured out that CActiveForm does it already!