Revision #13 has been created by rainyjune on Oct 9, 2010, 6:27:04 AM with the memo:
update Chinese version link
« previous (#11) next (#17) »
Changes
Title
unchanged
How to set up Unicode
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
Content
changed
[...]
AddDefaultCharset UTF-8
~~~
## 5. PHP string functions ##
PHP needs to use UTF-8 internally in order for e.g. string length validation to work correctly. Full Unicode support will be available in PHP 6 and is still [work in progress](http://www.php.net/~scoates/unicode/render_func_data.php).
For the time being t
### mbstring
The alternative is to use [mbstring functions](http://de.php.net/manual/en/ref.mbstring.php) instead of the non-multibyte aware counterparts. Since mbstring is a non-default extension it might not be available on every host. That's one of the reasons why Yii uses the non-multibyte functions like strlen() instead of mb_strlen()
.
One workaround by default.
#### Using mbstring with Yii > 1.1.1
Since version 1.1.1 you can use the [encoding](http://www.yiiframework.com/doc/api/CStringValidator#encoding-detail) parameter of CStringValidator. If you set it to `utf-8` it will use the mbstring functions for different string validation operations.
#### Using mbstring with older versions of Yii
A workaround for older releases is to use mbstring's [function overloading feature](http://de.php.net/manual/en/mbstring.overload.php). This will override then non-multibyte aware functions with their mbstring counterpart. To set this up add this in your php.ini:
~~~[...]
### Links
[Chinese version](http://dreamneverfall.cnprojects.ourplanet.tk/node/84)