Revision #23 has been created by kafeg on Feb 20, 2013, 2:57:00 AM with the memo:
add example for project convertation
« previous (#22) next (#25) »
Changes
Title
unchanged
How to set up Unicode
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
i18n, unicode
Content
changed
[...]
## 1. PHP script files ##
Make sure that you use an editor which is capable of using UTF-8 and save all your files UTF-8 encoded without [BOM](http://en.wikipedia.org/wiki/Byte_order_mark). If you have some older non-unicode files in your project open them with your editor and save them again UTF-8 encoded. On Linux you can also use command line tools like `recode` or `iconv` to convert a whole bunch of files.
For Example:
~~~
[bash]
$ cd /var/www/myproject/
$ sudo su
# for i in $(find -name '*.php');do encoding=$(file -bi $i | sed -e 's/.*[ ]charset=//'); iconv -f $encoding -t UTF-8 -o $i $i; done
# exit
~~~
## 2. Database tables ##
You need to set to UTF-8 the encoding of your connection to the SQL server. It's recommended to set up every table in your database needs to use the same charset for its content, but if it's not the case, the SQL server will convert the text on-the-fly. So **this step isn't mandatory, but it's highly recommended**.
The configuration for that might differ between database systems.[...]