Default validator options - how?!

There is no way to set some properties to validator, that would applied to all validators of same type (CStringValidator.encoding=‘utf-8’ for example), or am I wrong?! Any suggestions? :rolleyes:

Maybe by overriding the validateAttribute() method in CStringValidator and add your validation code

I know how to solve my problem, by using overriding and customization of validators, but I try to find the way to do it using internal features, without customization.

Following your logic, there should be a static property "encoding", but this disallow to set this property per validator.

I think, in your situation extending CStringValidator class is a good idea. You won’t need to set encoding somewhere (and then forget, where :) ) in your application, all common settings will be stored in the validator class.

"good" idea, but project almost completed, + all "length" validators without "encoding" property…

Turn on mbstring function overloading in php.ini (mbstring.func_overload = 7).

thx it’s really good solution :) (but if i didn’t have access to production php.ini?) ::)

Maybe possible through htaccess if you use Apache.

If you didn’t have access to the php.ini and if the server is strict enough that you cannot set this in htaccess, the only way would be to change the existing code unfortunately :(