I have to encode user entered data into utf-8, especially if it is numeric encode,
So I decided to use the following code snippet for encoding and then store it into database
$convmap = array ( 0x80, 0xffff, 0, 0xffff ); $str = htmlentities ( mb_encode_numericentity( $str, $convmap, 'UTF-8' ),ENT_QUOTES,"UTF-8",false );
But Yii default encode uses only CHtml::encode() which uses only htmlspecialchars() function
So I have decided to extend CHtml class for overriding the encode function, but I can’t figure out how to do it in Yii..
Suggest a good way to extend the Yii helper classes…
you can’t do it fully, This class is tightly integrated in the framework. ( i.e. used in widgets, activaeform’s etc… ),
one thing you can do is … extend it and create your class and use it in your entire application. Preprocess your model data before sending it to views/widgets.